@@ -1,102 +1,102 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class EnvironmentCheckerTest extends SapphireTest |
| 3 | 3 | { |
| 4 | - protected $usesDatabase = true; |
|
| 4 | + protected $usesDatabase = true; |
|
| 5 | 5 | |
| 6 | - public function setUpOnce() |
|
| 7 | - { |
|
| 8 | - parent::setUpOnce(); |
|
| 6 | + public function setUpOnce() |
|
| 7 | + { |
|
| 8 | + parent::setUpOnce(); |
|
| 9 | 9 | |
| 10 | - Phockito::include_hamcrest(); |
|
| 11 | - } |
|
| 10 | + Phockito::include_hamcrest(); |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public function setUp() |
|
| 14 | - { |
|
| 15 | - parent::setUp(); |
|
| 13 | + public function setUp() |
|
| 14 | + { |
|
| 15 | + parent::setUp(); |
|
| 16 | 16 | |
| 17 | - Config::nest(); |
|
| 18 | - } |
|
| 17 | + Config::nest(); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public function tearDown() |
|
| 21 | - { |
|
| 22 | - Config::unnest(); |
|
| 20 | + public function tearDown() |
|
| 21 | + { |
|
| 22 | + Config::unnest(); |
|
| 23 | 23 | |
| 24 | - parent::tearDown(); |
|
| 25 | - } |
|
| 24 | + parent::tearDown(); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function testOnlyLogsWithErrors() |
|
| 28 | - { |
|
| 29 | - Config::inst()->update('EnvironmentChecker', 'log_results_warning', true); |
|
| 30 | - Config::inst()->update('EnvironmentChecker', 'log_results_error', true); |
|
| 31 | - EnvironmentCheckSuite::register('test suite', new EnvironmentCheckerTest_CheckNoErrors()); |
|
| 32 | - $checker = Phockito::spy( |
|
| 33 | - 'EnvironmentChecker', |
|
| 34 | - 'test suite', |
|
| 35 | - 'test' |
|
| 36 | - ); |
|
| 27 | + public function testOnlyLogsWithErrors() |
|
| 28 | + { |
|
| 29 | + Config::inst()->update('EnvironmentChecker', 'log_results_warning', true); |
|
| 30 | + Config::inst()->update('EnvironmentChecker', 'log_results_error', true); |
|
| 31 | + EnvironmentCheckSuite::register('test suite', new EnvironmentCheckerTest_CheckNoErrors()); |
|
| 32 | + $checker = Phockito::spy( |
|
| 33 | + 'EnvironmentChecker', |
|
| 34 | + 'test suite', |
|
| 35 | + 'test' |
|
| 36 | + ); |
|
| 37 | 37 | |
| 38 | - $response = $checker->index(); |
|
| 39 | - Phockito::verify($checker, 0)->log(anything(), anything()); |
|
| 40 | - EnvironmentCheckSuite::reset(); |
|
| 41 | - } |
|
| 38 | + $response = $checker->index(); |
|
| 39 | + Phockito::verify($checker, 0)->log(anything(), anything()); |
|
| 40 | + EnvironmentCheckSuite::reset(); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function testLogsWithWarnings() |
|
| 44 | - { |
|
| 45 | - Config::inst()->update('EnvironmentChecker', 'log_results_warning', true); |
|
| 46 | - Config::inst()->update('EnvironmentChecker', 'log_results_error', false); |
|
| 47 | - EnvironmentCheckSuite::register('test suite', new EnvironmentCheckerTest_CheckWarnings()); |
|
| 48 | - EnvironmentCheckSuite::register('test suite', new EnvironmentCheckerTest_CheckErrors()); |
|
| 49 | - $checker = Phockito::spy( |
|
| 50 | - 'EnvironmentChecker', |
|
| 51 | - 'test suite', |
|
| 52 | - 'test' |
|
| 53 | - ); |
|
| 43 | + public function testLogsWithWarnings() |
|
| 44 | + { |
|
| 45 | + Config::inst()->update('EnvironmentChecker', 'log_results_warning', true); |
|
| 46 | + Config::inst()->update('EnvironmentChecker', 'log_results_error', false); |
|
| 47 | + EnvironmentCheckSuite::register('test suite', new EnvironmentCheckerTest_CheckWarnings()); |
|
| 48 | + EnvironmentCheckSuite::register('test suite', new EnvironmentCheckerTest_CheckErrors()); |
|
| 49 | + $checker = Phockito::spy( |
|
| 50 | + 'EnvironmentChecker', |
|
| 51 | + 'test suite', |
|
| 52 | + 'test' |
|
| 53 | + ); |
|
| 54 | 54 | |
| 55 | - $response = $checker->index(); |
|
| 56 | - Phockito::verify($checker, 1)->log(containsString('warning'), anything()); |
|
| 57 | - Phockito::verify($checker, 0)->log(containsString('error'), anything()); |
|
| 58 | - EnvironmentCheckSuite::reset(); |
|
| 59 | - } |
|
| 55 | + $response = $checker->index(); |
|
| 56 | + Phockito::verify($checker, 1)->log(containsString('warning'), anything()); |
|
| 57 | + Phockito::verify($checker, 0)->log(containsString('error'), anything()); |
|
| 58 | + EnvironmentCheckSuite::reset(); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function testLogsWithErrors() |
|
| 62 | - { |
|
| 63 | - Config::inst()->update('EnvironmentChecker', 'log_results_error', false); |
|
| 64 | - Config::inst()->update('EnvironmentChecker', 'log_results_error', true); |
|
| 65 | - EnvironmentCheckSuite::register('test suite', new EnvironmentCheckerTest_CheckWarnings()); |
|
| 66 | - EnvironmentCheckSuite::register('test suite', new EnvironmentCheckerTest_CheckErrors()); |
|
| 67 | - $checker = Phockito::spy( |
|
| 68 | - 'EnvironmentChecker', |
|
| 69 | - 'test suite', |
|
| 70 | - 'test' |
|
| 71 | - ); |
|
| 61 | + public function testLogsWithErrors() |
|
| 62 | + { |
|
| 63 | + Config::inst()->update('EnvironmentChecker', 'log_results_error', false); |
|
| 64 | + Config::inst()->update('EnvironmentChecker', 'log_results_error', true); |
|
| 65 | + EnvironmentCheckSuite::register('test suite', new EnvironmentCheckerTest_CheckWarnings()); |
|
| 66 | + EnvironmentCheckSuite::register('test suite', new EnvironmentCheckerTest_CheckErrors()); |
|
| 67 | + $checker = Phockito::spy( |
|
| 68 | + 'EnvironmentChecker', |
|
| 69 | + 'test suite', |
|
| 70 | + 'test' |
|
| 71 | + ); |
|
| 72 | 72 | |
| 73 | - $response = $checker->index(); |
|
| 74 | - Phockito::verify($checker, 0)->log(containsString('warning'), anything()); |
|
| 75 | - Phockito::verify($checker, 1)->log(containsString('error'), anything()); |
|
| 76 | - EnvironmentCheckSuite::reset(); |
|
| 77 | - } |
|
| 73 | + $response = $checker->index(); |
|
| 74 | + Phockito::verify($checker, 0)->log(containsString('warning'), anything()); |
|
| 75 | + Phockito::verify($checker, 1)->log(containsString('error'), anything()); |
|
| 76 | + EnvironmentCheckSuite::reset(); |
|
| 77 | + } |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | class EnvironmentCheckerTest_CheckNoErrors implements EnvironmentCheck, TestOnly |
| 81 | 81 | { |
| 82 | - public function check() |
|
| 83 | - { |
|
| 84 | - return array(EnvironmentCheck::OK, ''); |
|
| 85 | - } |
|
| 82 | + public function check() |
|
| 83 | + { |
|
| 84 | + return array(EnvironmentCheck::OK, ''); |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | class EnvironmentCheckerTest_CheckWarnings implements EnvironmentCheck, TestOnly |
| 89 | 89 | { |
| 90 | - public function check() |
|
| 91 | - { |
|
| 92 | - return array(EnvironmentCheck::WARNING, "test warning"); |
|
| 93 | - } |
|
| 90 | + public function check() |
|
| 91 | + { |
|
| 92 | + return array(EnvironmentCheck::WARNING, "test warning"); |
|
| 93 | + } |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | class EnvironmentCheckerTest_CheckErrors implements EnvironmentCheck, TestOnly |
| 97 | 97 | { |
| 98 | - public function check() |
|
| 99 | - { |
|
| 100 | - return array(EnvironmentCheck::ERROR, "test error"); |
|
| 101 | - } |
|
| 98 | + public function check() |
|
| 99 | + { |
|
| 100 | + return array(EnvironmentCheck::ERROR, "test error"); |
|
| 101 | + } |
|
| 102 | 102 | } |
@@ -5,23 +5,23 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class DevHealthControllerTest extends SapphireTest |
| 7 | 7 | { |
| 8 | - protected $usesDatabase = true; |
|
| 8 | + protected $usesDatabase = true; |
|
| 9 | 9 | |
| 10 | - public function testIndexCreatesChecker() |
|
| 11 | - { |
|
| 12 | - $controller = new DevHealthController(); |
|
| 10 | + public function testIndexCreatesChecker() |
|
| 11 | + { |
|
| 12 | + $controller = new DevHealthController(); |
|
| 13 | 13 | |
| 14 | - $request = new SS_HTTPRequest('GET', 'example.com'); |
|
| 14 | + $request = new SS_HTTPRequest('GET', 'example.com'); |
|
| 15 | 15 | |
| 16 | - // we need to fake authenticated access as BasicAuth::requireLogin doesn't like empty |
|
| 17 | - // permission type strings, which is what health check uses. |
|
| 16 | + // we need to fake authenticated access as BasicAuth::requireLogin doesn't like empty |
|
| 17 | + // permission type strings, which is what health check uses. |
|
| 18 | 18 | |
| 19 | - define('ENVCHECK_BASICAUTH_USERNAME', 'foo'); |
|
| 20 | - define('ENVCHECK_BASICAUTH_PASSWORD', 'bar'); |
|
| 19 | + define('ENVCHECK_BASICAUTH_USERNAME', 'foo'); |
|
| 20 | + define('ENVCHECK_BASICAUTH_PASSWORD', 'bar'); |
|
| 21 | 21 | |
| 22 | - $_SERVER['PHP_AUTH_USER'] = 'foo'; |
|
| 23 | - $_SERVER['PHP_AUTH_PW'] = 'bar'; |
|
| 22 | + $_SERVER['PHP_AUTH_USER'] = 'foo'; |
|
| 23 | + $_SERVER['PHP_AUTH_PW'] = 'bar'; |
|
| 24 | 24 | |
| 25 | - $this->assertInstanceOf('EnvironmentChecker', $controller->index($request)); |
|
| 26 | - } |
|
| 25 | + $this->assertInstanceOf('EnvironmentChecker', $controller->index($request)); |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -5,14 +5,14 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class DevCheckControllerTest extends SapphireTest |
| 7 | 7 | { |
| 8 | - protected $usesDatabase = true; |
|
| 8 | + protected $usesDatabase = true; |
|
| 9 | 9 | |
| 10 | - public function testIndexCreatesChecker() |
|
| 11 | - { |
|
| 12 | - $controller = new DevCheckController(); |
|
| 10 | + public function testIndexCreatesChecker() |
|
| 11 | + { |
|
| 12 | + $controller = new DevCheckController(); |
|
| 13 | 13 | |
| 14 | - $request = new SS_HTTPRequest('GET', 'example.com'); |
|
| 14 | + $request = new SS_HTTPRequest('GET', 'example.com'); |
|
| 15 | 15 | |
| 16 | - $this->assertInstanceOf('EnvironmentChecker', $controller->index($request)); |
|
| 17 | - } |
|
| 16 | + $this->assertInstanceOf('EnvironmentChecker', $controller->index($request)); |
|
| 17 | + } |
|
| 18 | 18 | } |