2015-09-10 23:13:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @mixin PHPUnit_Framework_TestCase
|
|
|
|
*/
|
2015-11-21 07:18:35 +01:00
|
|
|
class DevHealthControllerTest extends SapphireTest
|
|
|
|
{
|
|
|
|
public function testIndexCreatesChecker()
|
|
|
|
{
|
|
|
|
$controller = new DevHealthController();
|
2015-09-10 23:13:48 +02:00
|
|
|
|
2015-11-21 07:18:35 +01:00
|
|
|
$request = new SS_HTTPRequest('GET', 'example.com');
|
2015-09-10 23:13:48 +02:00
|
|
|
|
2015-11-21 07:18:35 +01: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-10 23:13:48 +02:00
|
|
|
|
2015-11-21 07:18:35 +01:00
|
|
|
define('ENVCHECK_BASICAUTH_USERNAME', 'foo');
|
|
|
|
define('ENVCHECK_BASICAUTH_PASSWORD', 'bar');
|
2015-09-10 23:13:48 +02:00
|
|
|
|
2015-11-21 07:18:35 +01:00
|
|
|
$_SERVER['PHP_AUTH_USER'] = 'foo';
|
|
|
|
$_SERVER['PHP_AUTH_PW'] = 'bar';
|
2015-09-10 23:13:48 +02:00
|
|
|
|
2015-11-21 07:18:35 +01:00
|
|
|
$this->assertInstanceOf('EnvironmentChecker', $controller->index($request));
|
|
|
|
}
|
2015-09-10 23:13:48 +02:00
|
|
|
}
|