Updating View test case for rendering refactor

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6615 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-04-01 03:34:57 +00:00
parent 067e6a5695
commit c4f03bf237

View file

@ -270,12 +270,9 @@ class ViewTest extends UnitTestCase {
} }
function testRender() { function testRender() {
restore_error_handler();
$View = new TestView($this->PostsController); $View = new TestView($this->PostsController);
ob_start(); $result = str_replace(array("\t", "\r\n", "\n"), "", $View->render('index'));
$View->render('index');
$result = str_replace(array("\t", "\r\n", "\n"), "", ob_get_clean());
set_error_handler('simpleTestErrorHandler');
$this->assertPattern("/<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\" \/><title>/", $result); $this->assertPattern("/<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\" \/><title>/", $result);
$this->assertPattern("/<div id=\"content\">posts index<\/div>/", $result); $this->assertPattern("/<div id=\"content\">posts index<\/div>/", $result);
$this->assertPattern("/<div id=\"content\">posts index<\/div>/", $result); $this->assertPattern("/<div id=\"content\">posts index<\/div>/", $result);
@ -285,12 +282,8 @@ class ViewTest extends UnitTestCase {
$this->PostsController->set('pause', 3); $this->PostsController->set('pause', 3);
$this->PostsController->set('page_title', 'yo what up'); $this->PostsController->set('page_title', 'yo what up');
restore_error_handler();
$View = new TestView($this->PostsController); $View = new TestView($this->PostsController);
ob_start(); $result = str_replace(array("\t", "\r\n", "\n"), "", $View->render(false, 'flash'));
$View->render(false, 'flash');
$result = str_replace(array("\t", "\r\n", "\n"), "", ob_get_clean());
set_error_handler('simpleTestErrorHandler');
$this->assertPattern("/<title>yo what up<\/title>/", $result); $this->assertPattern("/<title>yo what up<\/title>/", $result);
$this->assertPattern("/<p><a href=\"flash\">yo what up<\/a><\/p>/", $result); $this->assertPattern("/<p><a href=\"flash\">yo what up<\/a><\/p>/", $result);