Skip to content

Commit

Permalink
fixing up some broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gwoo committed Jul 20, 2009
1 parent f14a223 commit 0935eb0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
16 changes: 7 additions & 9 deletions cake/tests/cases/libs/controller/scaffold.test.php
Expand Up @@ -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
Expand All @@ -244,6 +249,8 @@ function setUp() {
*/
function tearDown() {
unset($this->Controller);

App::build();
}
/**
* testGetViewFilename method
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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);
}
/**
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/i18n.test.php
Expand Up @@ -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')
));
}
Expand Down
23 changes: 12 additions & 11 deletions cake/tests/cases/libs/view/theme.test.php
Expand Up @@ -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
*
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 0935eb0

Please sign in to comment.