Fixing failing tests in Dispatcher.test.

This commit is contained in:
mark_story 2010-08-28 00:19:09 -04:00
parent c76f205bcb
commit e4545dbe5e
3 changed files with 3 additions and 52 deletions

View file

@ -317,11 +317,7 @@ class Dispatcher {
}
$controller = null;
$view = new View($controller);
$return = $view->renderCache($filename, microtime(true));
if (!$return) {
ClassRegistry::removeObject('view');
}
return $return;
return $view->renderCache($filename, microtime(true));
}
}
return false;

View file

@ -62,7 +62,7 @@ class HelperCollection extends ObjectCollection {
}
$this->_loaded[$name] = new $helperClass($this->_View, $settings);
$vars = array('base', 'webroot', 'here', 'params', 'action', 'data', 'theme', 'plugin');
$vars = array('request', 'base', 'webroot', 'here', 'params', 'action', 'data', 'theme', 'plugin');
foreach ($vars as $var) {
$this->_loaded[$name]->{$var} = $this->_View->{$var};
}

View file

@ -852,7 +852,6 @@ class DispatcherTest extends CakeTestCase {
Router::reload();
Configure::write('App.baseUrl', '/index.php');
$Dispatcher = new TestDispatcher();
Configure::write('App.baseUrl','/index.php');
$url = array('controller' => 'pages', 'action' => 'display');
$controller = $Dispatcher->dispatch($url, array(
@ -866,7 +865,7 @@ class DispatcherTest extends CakeTestCase {
$expected = array('0' => 'home', 'param' => 'value', 'param2' => 'value2');
$this->assertIdentical($expected, $controller->passedArgs);
$this->assertEqual($Dispatcher->base . '/pages/display/home/param:value/param2:value2', $Dispatcher->here);
$this->assertEqual($Dispatcher->request->base . '/pages/display/home/param:value/param2:value2', $Dispatcher->request->here);
}
/**
@ -1583,50 +1582,6 @@ class DispatcherTest extends CakeTestCase {
unlink($filename);
}
/**
* test that cached() registers a view and un-registers it. Tests
* that helpers using don't fail
*
* @return void
*/
function testCachedRegisteringViewObject() {
Configure::write('Cache.disable', false);
Configure::write('Cache.check', true);
Configure::write('debug', 2);
$_POST = array();
$_SERVER['PHP_SELF'] = '/';
Router::reload();
App::build(array(
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
));
$dispatcher = new TestDispatcher();
$dispatcher->response = $this->getMock('CakeResponse', array('_sendHeader'));
$dispatcher->base = false;
$url = 'test_cached_pages/cache_form';
ob_start();
$dispatcher->dispatch($url);
$out = ob_get_clean();
ClassRegistry::flush();
ob_start();
$dispatcher->cached($url);
$cached = ob_get_clean();
$result = str_replace(array("\t", "\r\n", "\n"), "", $out);
$cached = preg_replace('/<!--+[^<>]+-->/', '', $cached);
$expected = str_replace(array("\t", "\r\n", "\n"), "", $cached);
$this->assertEqual($result, $expected);
$filename = $this->__cachePath($dispatcher->here);
@unlink($filename);
ClassRegistry::flush();
}
/**
* testHttpMethodOverrides method
*