Skip to content

Commit

Permalink
Consistently setting setUp() and tearDown() on test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
shama committed Dec 4, 2011
1 parent 1bc3583 commit 5388237
Show file tree
Hide file tree
Showing 35 changed files with 89 additions and 67 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
Expand Up @@ -45,7 +45,7 @@ public function setUp() {
}

/**
* teardown method
* tearDown method
*
* @return void
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/Case/Configure/IniReaderTest.php
Expand Up @@ -32,8 +32,8 @@ class IniReaderTest extends CakeTestCase {
*
* @return void
*/
public function setup() {
parent::setup();
public function setUp() {
parent::setUp();
$this->path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS;
}

Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Test/Case/Console/Command/AclShellTest.php
Expand Up @@ -37,11 +37,12 @@ class AclShellTest extends CakeTestCase {
public $fixtures = array('core.aco', 'core.aro', 'core.aros_aco');

/**
* setup method
* setUp method
*
* @return void
*/
public function setUp() {
parent::setUp();
Configure::write('Acl.database', 'test');
Configure::write('Acl.classname', 'DbAcl');

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Console/Command/BakeShellTest.php
Expand Up @@ -59,7 +59,7 @@ public function setUp() {
}

/**
* teardown method
* tearDown method
*
* @return void
*/
Expand Down
Expand Up @@ -60,7 +60,7 @@ public function setUp() {
}

/**
* teardown
* tearDown
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Console/Command/SchemaShellTest.php
Expand Up @@ -97,7 +97,7 @@ class SchemaShellTest extends CakeTestCase {
);

/**
* setup method
* setUp method
*
* @return void
*/
Expand Down
Expand Up @@ -64,6 +64,7 @@ class ControllerTaskTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Task = $this->getMock('ControllerTask',
Expand All @@ -86,14 +87,15 @@ public function setUp() {
}

/**
* teardown method
* tearDown method
*
* @return void
*/
public function teardown() {
public function tearDown() {
unset($this->Task);
ClassRegistry::flush();
App::build();
parent::tearDown();
}

/**
Expand Down
Expand Up @@ -31,7 +31,7 @@
class DbConfigTaskTest extends CakeTestCase {

/**
* setup method
* setUp method
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php
Expand Up @@ -95,7 +95,7 @@ protected function _setupOtherMocks() {
}

/**
* teardown method
* tearDown method
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Console/Command/Task/PluginTaskTest.php
Expand Up @@ -36,7 +36,7 @@
class PluginTaskTest extends CakeTestCase {

/**
* setup method
* setUp method
*
* @return void
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php
Expand Up @@ -35,7 +35,7 @@
class ProjectTaskTest extends CakeTestCase {

/**
* setup method
* setUp method
*
* @return void
*/
Expand All @@ -52,7 +52,7 @@ public function setUp() {
}

/**
* teardown method
* tearDown method
*
* @return void
*/
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php
Expand Up @@ -33,11 +33,11 @@
class TemplateTaskTest extends CakeTestCase {

/**
* setup method
* setUp method
*
* @return void
*/
public function setup() {
public function setUp() {
parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
Expand All @@ -49,7 +49,7 @@ public function setup() {
}

/**
* teardown method
* tearDown method
*
* @return void
*/
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
Expand Up @@ -220,12 +220,12 @@ class TestTaskTest extends CakeTestCase {
public $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');

/**
* setup method
* setUp method
*
* @return void
*/
public function setup() {
parent::setup();
public function setUp() {
parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Console/ConsoleErrorHandlerTest.php
Expand Up @@ -38,7 +38,7 @@ public function setUp() {
}

/**
* teardown
* tearDown
*
* @return void
*/
Expand Down
10 changes: 6 additions & 4 deletions lib/Cake/Test/Case/Console/TaskCollectionTest.php
Expand Up @@ -22,23 +22,25 @@

class TaskCollectionTest extends CakeTestCase {
/**
* setup
* setUp
*
* @return void
*/
public function setup() {
public function setUp() {
parent::setUp();
$shell = $this->getMock('Shell', array(), array(), '', false);
$dispatcher = $this->getMock('ShellDispatcher', array(), array(), '', false);
$this->Tasks = new TaskCollection($shell, $dispatcher);
}

/**
* teardown
* tearDown
*
* @return void
*/
public function teardown() {
public function tearDown() {
unset($this->Tasks);
parent::tearDown();
}

/**
Expand Down
Expand Up @@ -26,7 +26,7 @@
class ActionsAuthorizeTest extends CakeTestCase {

/**
* setup
* setUp
*
* @return void
*/
Expand Down
Expand Up @@ -57,7 +57,7 @@ public function setUp() {
}

/**
* teardown
* tearDown
*
* @return void
*/
Expand Down
Expand Up @@ -59,7 +59,7 @@ public function setUp() {
}

/**
* teardown
* tearDown
*
* @return void
*/
Expand Down
10 changes: 6 additions & 4 deletions lib/Cake/Test/Case/Controller/ComponentCollectionTest.php
Expand Up @@ -29,21 +29,23 @@ class CookieAliasComponent extends CookieComponent {

class ComponentCollectionTest extends CakeTestCase {
/**
* setup
* setUp
*
* @return void
*/
public function setup() {
public function setUp() {
parent::setUp();
$this->Components = new ComponentCollection();
}

/**
* teardown
* tearDown
*
* @return void
*/
public function teardown() {
public function tearDown() {
unset($this->Components);
parent::tearDown();
}

/**
Expand Down
6 changes: 4 additions & 2 deletions lib/Cake/Test/Case/Controller/ControllerTest.php
Expand Up @@ -381,19 +381,21 @@ class ControllerTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
App::objects('plugin', null, false);
App::build();
Router::reload();
}

/**
* teardown
* tearDown
*
* @return void
*/
public function teardown() {
public function tearDown() {
CakePlugin::unload();
App::build();
parent::tearDown();
}

/**
Expand Down
7 changes: 5 additions & 2 deletions lib/Cake/Test/Case/Error/ErrorHandlerTest.php
Expand Up @@ -29,12 +29,14 @@
class ErrorHandlerTest extends CakeTestCase {

public $_restoreError = false;

/**
* setup create a request object to get out of router later.
*
* @return void
*/
public function setUp() {
parent::setUp();
App::build(array(
'View' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS
Expand All @@ -51,17 +53,18 @@ public function setUp() {
}

/**
* teardown
* tearDown
*
* @return void
*/
public function teardown() {
public function tearDown() {
Configure::write('debug', $this->_debug);
Configure::write('Error', $this->_error);
App::build();
if ($this->_restoreError) {
restore_error_handler();
}
parent::tearDown();
}

/**
Expand Down
7 changes: 5 additions & 2 deletions lib/Cake/Test/Case/Error/ExceptionRendererTest.php
Expand Up @@ -142,12 +142,14 @@ class MissingWidgetThingException extends NotFoundException { }
class ExceptionRendererTest extends CakeTestCase {

public $_restoreError = false;

/**
* setup create a request object to get out of router later.
*
* @return void
*/
public function setUp() {
parent::setUp();
App::build(array(
'views' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS
Expand All @@ -164,17 +166,18 @@ public function setUp() {
}

/**
* teardown
* tearDown
*
* @return void
*/
public function teardown() {
public function tearDown() {
Configure::write('debug', $this->_debug);
Configure::write('Error', $this->_error);
App::build();
if ($this->_restoreError) {
restore_error_handler();
}
parent::tearDown();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php
Expand Up @@ -71,8 +71,8 @@ public static function teardownAfterClass() {
*
* @return void
*/
public function setup() {
parent::setup();
public function setUp() {
parent::setUp();
Configure::write('Session', array(
'defaults' => 'php',
'cookie' => 'cakephp',
Expand Down
Expand Up @@ -63,7 +63,7 @@ public function setUp() {
}

/**
* teardown
* tearDown
*
* @return void
*/
Expand Down

0 comments on commit 5388237

Please sign in to comment.