fixing up some broken tests

This commit is contained in:
gwoo 2009-07-20 09:59:16 -07:00
parent f14a223f1d
commit 0935eb0477
3 changed files with 20 additions and 21 deletions

View file

@ -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 @@ class ScaffoldViewTest extends CakeTestCase {
*/
function tearDown() {
unset($this->Controller);
App::build();
}
/**
* testGetViewFilename method
@ -293,13 +300,6 @@ class ScaffoldViewTest extends CakeTestCase {
$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 @@ class ScaffoldViewTest extends CakeTestCase {
. 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);
}
/**

View file

@ -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')
));
}

View file

@ -159,6 +159,18 @@ class ThemeViewTest extends CakeTestCase {
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 @@ class ThemeViewTest extends CakeTestCase {
$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 @@ class ThemeViewTest extends CakeTestCase {
$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);