diff --git a/tests/classes/RouterTest.php b/tests/classes/RouterTest.php index c8b7da9..b2a2ce9 100644 --- a/tests/classes/RouterTest.php +++ b/tests/classes/RouterTest.php @@ -19,53 +19,6 @@ class RouterTest extends PHPUnit_Framework_TestCase file_put_contents(SITE_MODULE_PATH . 'home.php', $module); } - public function testSiteDown() - { - $this->config->data['pickles']['disabled'] = true; - - $this->expectOutputRegex('/Test Server is currently down for maintenance/'); - - new Router(); - } - - public function testCustomSiteDown() - { - $this->config->data['pickles']['disabled'] = true; - - file_put_contents(SITE_TEMPLATE_PATH . '__shared/maintenance.phtml', '

Custom Down for Maintenance

'); - - new Router(); - - $this->expectOutputRegex('/

Custom Down for Maintenance<\/h1>/'); - } - - public function testAttributesInURI() - { - setUpRequest('home/id:123'); - - new Router(); - - $this->assertEquals(123, Browser::get('id')); - - setUpRequest('home/id:456/foo:bar'); - - new Router(); - - // Compensates for 2 empty template executions of the Router - $this->expectOutputString('[][]'); - $this->assertEquals(456, Browser::get('id')); - $this->assertEquals('bar', Browser::get('foo')); - } - - public function testUpperCaseURI() - { - setUpRequest('TESTING'); - - new Router(); - - $this->assertTrue(in_array('Location: /testing', xdebug_get_headers())); - } - public function testForceSecure() { setUpRequest('secure'); @@ -93,54 +46,6 @@ class RouterTest extends PHPUnit_Framework_TestCase $this->assertTrue(in_array('Location: http://testsite.com/insecure', xdebug_get_headers())); } - public function testNotAuthenticated() - { - setUpRequest('notauth'); - - $module = 'expectOutputString('[]'); - - $this->assertTrue(in_array('Location: http://testsite.com/login', xdebug_get_headers())); - } - - public function testValidRequestMethod() - { - setUpRequest('validrequestmethod'); - - $module = ' "bar"]; }' - . '}'; - - file_put_contents(SITE_MODULE_PATH . 'validrequestmethod.php', $module); - - new Router(); - - $this->expectOutputString('{"foo":"bar"}'); - } - - public function testInvalidRequestMethod() - { - setUpRequest('invalidrequestmethod'); - - $module = ' "bar"]; }' - . '}'; - - file_put_contents(SITE_MODULE_PATH . 'invalidrequestmethod.php', $module); - - new Router(); - - $this->expectOutputString('{"status":"error","message":"There was a problem with your request method."}'); - } - public function testValidationErrors() { setUpRequest('validationerrors'); @@ -156,75 +61,5 @@ class RouterTest extends PHPUnit_Framework_TestCase $this->expectOutputString('{"status":"error","message":"The test field is required."}'); } - - public function testError404() - { - setUpRequest('fourohfour'); - - new Router(); - - $this->assertTrue(in_array('Status: 404 Not Found', xdebug_get_headers())); - $this->expectOutputRegex('/

Not Found<\/h1>/'); - } - - public function testCustomError404() - { - setUpRequest('customfourohfour'); - - file_put_contents(SITE_TEMPLATE_PATH . '__shared/404.phtml', '

Custom Not Found

'); - - new Router(); - - $this->assertTrue(in_array('Status: 404 Not Found', xdebug_get_headers())); - $this->expectOutputRegex('/

Custom Not Found<\/h1>/'); - } - - public function testProfilerOutput() - { - $this->config->data['pickles']['profiler'] = true; - - $this->expectOutputRegex('/id="pickles-profiler"/'); - - new Router(); - } - - public function testTwoValidTemplates() - { - $this->config->data['pickles']['profiler'] = true; - - setUpRequest('validtemplates'); - - $module = 'child template'); - - // Vim syntax highlighting borks unless ----v - $child = 'template; ?' . '>' . "\n"; - - $html = << - - -

parent template

- {$child} - - -HTML; - - file_put_contents(SITE_TEMPLATE_PATH . '__shared/index.phtml', $html); - - new Router(); - - $this->expectOutputRegex('/^ - - -

parent template<\/h1> -
child template<\/div> -<\/body> -<\/html>.+