From 0935eb04773ce4055c782114bf71aa516bb9b740 Mon Sep 17 00:00:00 2001 From: gwoo Date: Mon, 20 Jul 2009 09:59:16 -0700 Subject: [PATCH] fixing up some broken tests --- .../cases/libs/controller/scaffold.test.php | 16 ++++++------- cake/tests/cases/libs/i18n.test.php | 2 +- cake/tests/cases/libs/view/theme.test.php | 23 ++++++++++--------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/cake/tests/cases/libs/controller/scaffold.test.php b/cake/tests/cases/libs/controller/scaffold.test.php index d0813a4197b..5ed30a97ec5 100644 --- a/cake/tests/cases/libs/controller/scaffold.test.php +++ b/cake/tests/cases/libs/controller/scaffold.test.php @@ -235,6 +235,11 @@ class ScaffoldViewTest extends CakeTestCase { */ function setUp() { $this->Controller =& new ScaffoldMockController(); + + App::build(array( + 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS), + 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) + )); } /** * tearDown method @@ -244,6 +249,8 @@ function setUp() { */ function tearDown() { unset($this->Controller); + + App::build(); } /** * testGetViewFilename method @@ -293,13 +300,6 @@ function testGetViewFilename() { $expected = 'cake' . DS . 'libs' . DS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp'; $this->assertEqual($result, $expected); - $_back = array( - 'viewPaths' => Configure::read('viewPaths'), - 'pluginPaths' => Configure::read('pluginPaths'), - ); - Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS)); - Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)); - $Controller =& new ScaffoldMockController(); $Controller->scaffold = 'admin'; $Controller->viewPath = 'posts'; @@ -329,8 +329,6 @@ function testGetViewFilename() { . DS .'test_plugin' . DS . 'views' . DS . 'tests' . DS . 'scaffold.edit.ctp'; $this->assertEqual($result, $expected); - Configure::write('viewPaths', $_back['viewPaths']); - Configure::write('pluginPaths', $_back['pluginPaths']); Configure::write('Routing.admin', $_admin); } /** diff --git a/cake/tests/cases/libs/i18n.test.php b/cake/tests/cases/libs/i18n.test.php index 3650a120612..0a3e61d1023 100644 --- a/cake/tests/cases/libs/i18n.test.php +++ b/cake/tests/cases/libs/i18n.test.php @@ -40,7 +40,7 @@ class I18nTest extends CakeTestCase { */ function setUp() { App::build(array( - 'locales' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'locale') + 'locales' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'locale'), 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins') )); } diff --git a/cake/tests/cases/libs/view/theme.test.php b/cake/tests/cases/libs/view/theme.test.php index 4644bf11cf2..ee69ccb68a9 100644 --- a/cake/tests/cases/libs/view/theme.test.php +++ b/cake/tests/cases/libs/view/theme.test.php @@ -159,6 +159,18 @@ function tearDown() { unset($this->PostsController); unset($this->Controller); } +/** + * startTest + * + * @access public + * @return void + */ + function startTest() { + App::build(array( + 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS), + 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS) + )); + } /** * endTest * @@ -182,11 +194,6 @@ function testPluginGetTemplate() { $this->Controller->theme = 'test_plugin_theme'; $ThemeView = new TestThemeView($this->Controller); - App::build(array( - 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS), - 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS) - )); - $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS .'test_plugin' . DS . 'views' . DS . 'themed' . DS . 'test_plugin_theme' . DS .'tests' . DS .'index.ctp'; $result = $ThemeView->getViewFileName('index'); $this->assertEqual($result, $expected); @@ -210,12 +217,6 @@ function testGetTemplate() { $ThemeView = new TestThemeView($this->Controller); $ThemeView->theme = 'test_theme'; - - App::build(array( - 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS), - 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS) - )); - $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS .'pages' . DS .'home.ctp'; $result = $ThemeView->getViewFileName('home'); $this->assertEqual($result, $expected);