silverstripe-environmentcheck/tests/DevHealthControllerTest.php

28 lines
761 B
PHP
Raw Permalink Normal View History

2015-09-11 09:13:48 +12:00
<?php
/**
* @mixin PHPUnit_Framework_TestCase
*/
2015-11-21 19:18:35 +13:00
class DevHealthControllerTest extends SapphireTest
{
2016-07-12 14:08:29 +12:00
protected $usesDatabase = true;
2015-11-21 19:18:35 +13:00
public function testIndexCreatesChecker()
{
$controller = new DevHealthController();
2015-09-11 09:13:48 +12:00
2015-11-21 19:18:35 +13:00
$request = new SS_HTTPRequest('GET', 'example.com');
2015-09-11 09:13:48 +12:00
2015-11-21 19:18:35 +13:00
// we need to fake authenticated access as BasicAuth::requireLogin doesn't like empty
// permission type strings, which is what health check uses.
2015-09-11 09:13:48 +12:00
2015-11-21 19:18:35 +13:00
define('ENVCHECK_BASICAUTH_USERNAME', 'foo');
define('ENVCHECK_BASICAUTH_PASSWORD', 'bar');
2015-09-11 09:13:48 +12:00
2015-11-21 19:18:35 +13:00
$_SERVER['PHP_AUTH_USER'] = 'foo';
$_SERVER['PHP_AUTH_PW'] = 'bar';
2015-09-11 09:13:48 +12:00
2015-11-21 19:18:35 +13:00
$this->assertInstanceOf('EnvironmentChecker', $controller->index($request));
}
2015-09-11 09:13:48 +12:00
}