adding additional case for Router::normalize() and Controller::referer() to show #5157 is invalid

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7463 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-08-13 18:07:52 +00:00
parent 0b8d7027ec
commit 074ede4639
2 changed files with 23 additions and 11 deletions

View file

@ -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

View file

@ -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