diff --git a/cake/tests/cases/libs/controller/controller.test.php b/cake/tests/cases/libs/controller/controller.test.php index b92b2726a..d09b43f28 100644 --- a/cake/tests/cases/libs/controller/controller.test.php +++ b/cake/tests/cases/libs/controller/controller.test.php @@ -263,16 +263,18 @@ class ControllerTest extends CakeTestCase { * @return void */ function testPersistent() { + Configure::write('Cache.disable', false); $Controller =& new Controller(); $Controller->modelClass = 'ControllerPost'; $Controller->persistModel = true; $Controller->constructClasses(); $this->assertTrue(file_exists(CACHE . 'persistent' . DS .'controllerpost.php')); $this->assertTrue(is_a($Controller->ControllerPost, 'ControllerPost')); - unlink(CACHE . 'persistent' . DS . 'controllerpost.php'); - unlink(CACHE . 'persistent' . DS . 'controllerpostregistry.php'); + @unlink(CACHE . 'persistent' . DS . 'controllerpost.php'); + @unlink(CACHE . 'persistent' . DS . 'controllerpostregistry.php'); unset($Controller); + Configure::write('Cache.disable', true); } /** * testPaginate method @@ -628,6 +630,13 @@ class ControllerTest extends CakeTestCase { $result = $Controller->referer(null, false); $expected = '/some/path'; $this->assertIdentical($result, $expected); + + $Controller->webroot = '/recipe/'; + + $_SERVER['HTTP_REFERER'] = FULL_BASE_URL.$Controller->webroot.'recipes/add'; + $result = $Controller->referer(); + $expected = '/recipes/add'; + $this->assertIdentical($result, $expected); } /** * testSetAction method diff --git a/cake/tests/cases/libs/router.test.php b/cake/tests/cases/libs/router.test.php index 2a636f5ac..cf573e436 100644 --- a/cake/tests/cases/libs/router.test.php +++ b/cake/tests/cases/libs/router.test.php @@ -255,6 +255,9 @@ class RouterTest extends CakeTestCase { $result = Router::normalize('/users/login/scope://foo'); $this->assertEqual($result, '/users/login/scope:/foo'); + + $result = Router::normalize('/recipe/recipes/add'); + $this->assertEqual($result, '/recipe/recipes/add'); } /** * testUrlGeneration method @@ -1375,36 +1378,36 @@ class RouterTest extends CakeTestCase { $result = Router::prefixes(); $expected = array('admin'); $this->assertEqual($result, $expected); - + Router::reload(); - + $prefixParams = array('prefix' => 'members', 'members' => true); Router::connect('/members/:controller', $prefixParams); Router::connect('/members/:controller/:action', $prefixParams); Router::connect('/members/:controller/:action/*', $prefixParams); - + Router::setRequestInfo(array( array('controller' => 'controller', 'action' => 'index', 'form' => array(), 'url' => array(), 'plugin' => null), array('base' => '/base', 'here' => '/', 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array()) )); - + $result = Router::parse('/members/posts/index'); $expected = array('pass' => array(), 'named' => array(), 'prefix' => 'members', 'plugin' => null, 'controller' => 'posts', 'action' => 'index', 'members' => true); $this->assertEqual($result, $expected); - + $result = Router::url(array('members' => true, 'controller' => 'posts', 'action' =>'index', 'page' => 2)); $expected = '/base/members/posts/index/page:2'; $this->assertEqual($result, $expected); - + $result = Router::url(array('members' => true, 'controller' => 'users', 'action' => 'add')); $expected = '/base/members/users/add'; $this->assertEqual($result, $expected); - + $result = Router::parse('/posts/index'); $expected = array('pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'index'); - $this->assertEqual($result, $expected); + $this->assertEqual($result, $expected); } - + /** * Tests URL generation with flags and prefixes in and out of context *