mirror of
https://github.com/silverstripe/silverstripe-environmentcheck
synced 2024-10-22 17:05:40 +02:00
254ed4801f
* Update composer constraint for 4.x compat * 4.x compatibility: Rename "code" to "src" and add PSR-4 autoloading * Restructure code and tests for PSR-4 * Implement namespaces * Implement namespaced throughout * PSR-2 formatting updates, separate Result from CheckSuite, implement PSR-3 logging, fix tests * FIX Routes and template location * Update readme. Allow check classes to be namespaced or not. * Add entry to changelog * FIX Ensure DatabaseCheckTest always has a member. Allow strings or objects for $check in the suite * Update readme to be clearer about passing checks with or without namespaces * Revert namespace checking and implement Injector aliases instead. Update readme.
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\EnvironmentCheck\Tests\Controllers;
|
|
|
|
use SilverStripe\Control\HTTPRequest;
|
|
use SilverStripe\Dev\SapphireTest;
|
|
use SilverStripe\EnvironmentCheck\Controllers\DevHealthController;
|
|
|
|
/**
|
|
* Class DevHealthControllerTest
|
|
*
|
|
* @mixin PHPUnit_Framework_TestCase
|
|
*
|
|
* @package environmentcheck
|
|
*/
|
|
class DevHealthControllerTest extends SapphireTest
|
|
{
|
|
/**
|
|
* {@inheritDoc}
|
|
* @var array
|
|
*/
|
|
protected $usesDatabase = true;
|
|
|
|
public function testIndexCreatesChecker()
|
|
{
|
|
$controller = new DevHealthController();
|
|
|
|
$request = new HTTPRequest('GET', 'example.com');
|
|
|
|
// we need to fake authenticated access as BasicAuth::requireLogin doesn't like empty
|
|
// permission type strings, which is what health check uses.
|
|
|
|
define('ENVCHECK_BASICAUTH_USERNAME', 'foo');
|
|
define('ENVCHECK_BASICAUTH_PASSWORD', 'bar');
|
|
|
|
$_SERVER['PHP_AUTH_USER'] = 'foo';
|
|
$_SERVER['PHP_AUTH_PW'] = 'bar';
|
|
|
|
$this->assertInstanceOf('SilverStripe\\EnvironmentCheck\\EnvironmentChecker', $controller->index($request));
|
|
}
|
|
}
|