Add missing parent calls.

Fixes piles of failing tests.
This commit is contained in:
mark_story 2012-04-15 22:20:34 -04:00
parent 9fbd57331f
commit 72c3059d94
28 changed files with 42 additions and 76 deletions

View file

@ -34,20 +34,10 @@ class BasicsTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
App::build(array(
'Locale' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Locale' . DS)
));
$this->_language = Configure::read('Config.language');
}
/**
* tearDown method
*
* @return void
*/
public function tearDown() {
App::build();
Configure::write('Config.language', $this->_language);
}
/**

View file

@ -32,6 +32,7 @@ class CacheTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
$this->_cacheDisable = Configure::read('Cache.disable');
Configure::write('Cache.disable', false);
@ -45,6 +46,7 @@ class CacheTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
parent::tearDown();
Configure::write('Cache.disable', $this->_cacheDisable);
Cache::config('default', $this->_defaultCacheConfig['settings']);
}

View file

@ -32,6 +32,7 @@ class ApcEngineTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
$this->skipIf(!function_exists('apc_store'), 'Apc is not installed or configured properly.');
$this->_cacheDisable = Configure::read('Cache.disable');
@ -45,6 +46,7 @@ class ApcEngineTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
parent::tearDown();
Configure::write('Cache.disable', $this->_cacheDisable);
Cache::drop('apc');
Cache::config('default');

View file

@ -51,6 +51,7 @@ class MemcacheEngineTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
$this->skipIf(!class_exists('Memcache'), 'Memcache is not installed or configured properly.');
$this->_cacheDisable = Configure::read('Cache.disable');
@ -68,6 +69,7 @@ class MemcacheEngineTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
parent::tearDown();
Configure::write('Cache.disable', $this->_cacheDisable);
Cache::drop('memcache');
Cache::config('default');

View file

@ -32,6 +32,7 @@ class WincacheEngineTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
$this->skipIf(!function_exists('wincache_ucache_set'), 'Wincache is not installed or configured properly.');
$this->_cacheDisable = Configure::read('Cache.disable');
Configure::write('Cache.disable', false);
@ -44,6 +45,7 @@ class WincacheEngineTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
parent::tearDown();
Configure::write('Cache.disable', $this->_cacheDisable);
Cache::drop('wincache');
Cache::config('default');

View file

@ -32,10 +32,10 @@ class XcacheEngineTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
if (!function_exists('xcache_set')) {
$this->markTestSkipped('Xcache is not installed or configured properly');
}
$this->_cacheDisable = Configure::read('Cache.disable');
Configure::write('Cache.disable', false);
Cache::config('xcache', array('engine' => 'Xcache', 'prefix' => 'cake_'));
}
@ -46,8 +46,8 @@ class XcacheEngineTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
Configure::write('Cache.disable', $this->_cacheDisable);
Cache::config('default');
parent::tearDown();
Cache::drop('xcache');
}
/**

View file

@ -40,6 +40,7 @@ class TestShellTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
@ -57,6 +58,7 @@ class TestShellTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
parent::tearDown();
unset($this->Dispatch, $this->Shell);
}

View file

@ -38,6 +38,7 @@ class ConsoleOutputTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
parent::tearDown();
unset($this->output);
}

View file

@ -1,4 +1,4 @@
<?php
<?
/**
* IniAclTest file.
*

View file

@ -29,6 +29,7 @@ class_exists('AclComponent');
class PhpAclTest extends CakeTestCase {
public function setUp() {
parent::setUp();
Configure::write('Acl.classname', 'PhpAcl');
$Collection = new ComponentCollection();
$this->PhpAcl = new PhpAcl();

View file

@ -53,7 +53,6 @@ class BasicAuthenticateTest extends CakeTestCase {
$password = Security::hash('password', null, true);
$User = ClassRegistry::init('User');
$User->updateAll(array('password' => $User->getDataSource()->value($password)));
$this->server = $_SERVER;
$this->response = $this->getMock('CakeResponse');
}
@ -64,7 +63,6 @@ class BasicAuthenticateTest extends CakeTestCase {
*/
public function tearDown() {
parent::tearDown();
$_SERVER = $this->server;
}
/**

View file

@ -31,9 +31,8 @@ class CrudAuthorizeTest extends CakeTestCase {
* @return void
*/
public function setUp() {
Configure::write('Routing.prefixes', array());
parent::setUp();
Configure::write('Routing.prefixes', array());
$this->Acl = $this->getMock('AclComponent', array(), array(), '', false);
$this->Components = $this->getMock('ComponentCollection');

View file

@ -306,9 +306,6 @@ class AuthComponentTest extends CakeTestCase {
*/
public function setUp() {
parent::setUp();
$this->_server = $_SERVER;
$this->_env = $_ENV;
Configure::write('Security.salt', 'YJfIxfs2guVoUubWDYhG93b0qyJfIxfs2guwvniR2G0FgaC9mi');
Configure::write('Security.cipherSeed', 770011223369876);
@ -339,8 +336,6 @@ class AuthComponentTest extends CakeTestCase {
*/
public function tearDown() {
parent::tearDown();
$_SERVER = $this->_server;
$_ENV = $this->_env;
TestAuthComponent::clearUser();
$this->Auth->Session->delete('Auth');

View file

@ -148,13 +148,12 @@ class EmailComponentTest extends CakeTestCase {
* @return void
*/
public function setUp() {
$this->_appEncoding = Configure::read('App.encoding');
parent::setUp();
Configure::write('App.encoding', 'UTF-8');
$this->Controller = new EmailTestController();
$this->Controller->Components->init($this->Controller);
$this->Controller->EmailTest->initialize($this->Controller, array());
self::$sentDate = date(DATE_RFC2822);
@ -164,17 +163,6 @@ class EmailComponentTest extends CakeTestCase {
));
}
/**
* tearDown method
*
* @return void
*/
public function tearDown() {
Configure::write('App.encoding', $this->_appEncoding);
App::build();
ClassRegistry::flush();
}
/**
* testSendFormats method
*

View file

@ -99,7 +99,6 @@ class RequestHandlerComponentTest extends CakeTestCase {
*/
public function setUp() {
parent::setUp();
$this->_server = $_SERVER;
$this->_init();
}
@ -128,7 +127,6 @@ class RequestHandlerComponentTest extends CakeTestCase {
if (!headers_sent()) {
header('Content-type: text/html'); //reset content type.
}
$_SERVER = $this->_server;
call_user_func_array('Router::parseExtensions', $this->_extensions);
}

View file

@ -45,8 +45,8 @@ class ComponentCollectionTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
unset($this->Components);
parent::tearDown();
unset($this->Components);
}
/**

View file

@ -220,22 +220,13 @@ class ComponentTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
$this->_pluginPaths = App::path('plugins');
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
));
}
/**
* tearDown method
*
* @return void
*/
public function tearDown() {
App::build();
ClassRegistry::flush();
}
/**
* test accessing inner components.
*

View file

@ -425,9 +425,8 @@ class ControllerTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
CakePlugin::unload();
App::build();
parent::tearDown();
CakePlugin::unload();
}
/**

View file

@ -30,6 +30,7 @@ class AppTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
parent::tearDown();
CakePlugin::unload();
}

View file

@ -31,6 +31,7 @@ class CakePluginTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
), App::RESET);
@ -43,9 +44,8 @@ class CakePluginTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
App::build();
parent::tearDown();
CakePlugin::unload();
Configure::delete('CakePluginTest');
}
/**

View file

@ -33,9 +33,7 @@ class ConfigureTest extends CakeTestCase {
* @return void
*/
public function setUp() {
$this->_cacheDisable = Configure::read('Cache.disable');
$this->_debug = Configure::read('debug');
parent::setUp();
Configure::write('Cache.disable', true);
App::build();
App::objects('plugin', null, true);
@ -47,6 +45,7 @@ class ConfigureTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
parent::tearDown();
if (file_exists(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_core_paths')) {
unlink(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_core_paths');
}
@ -65,8 +64,6 @@ class ConfigureTest extends CakeTestCase {
if (file_exists(TMP . 'cache' . DS . 'persistent' . DS . 'test.php')) {
unlink(TMP . 'cache' . DS . 'persistent' . DS . 'test.php');
}
Configure::write('debug', $this->_debug);
Configure::write('Cache.disable', $this->_cacheDisable);
Configure::drop('test');
}

View file

@ -305,6 +305,7 @@ class ObjectTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
$this->object = new TestObject();
}
@ -314,7 +315,7 @@ class ObjectTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
App::build();
parent::tearDown();
CakePlugin::unload();
unset($this->object);
}

View file

@ -56,10 +56,10 @@ class ErrorHandlerTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
parent::tearDown();
if ($this->_restoreError) {
restore_error_handler();
}
parent::tearDown();
}
/**

View file

@ -174,10 +174,10 @@ class ExceptionRendererTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
parent::tearDown();
if ($this->_restoreError) {
restore_error_handler();
}
parent::tearDown();
}
/**

View file

@ -211,6 +211,7 @@ class AclBehaviorTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
Configure::write('Acl.database', 'test');
$this->Aco = new Aco();
@ -223,7 +224,7 @@ class AclBehaviorTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
ClassRegistry::flush();
parent::tearDown();
unset($this->Aro, $this->Aco);
}

View file

@ -49,15 +49,6 @@ class TranslateBehaviorTest extends CakeTestCase {
'core.translate_with_prefix'
);
/**
* tearDown method
*
* @return void
*/
public function tearDown() {
ClassRegistry::flush();
}
/**
* Test that count queries with conditions get the correct joins
*

View file

@ -117,8 +117,8 @@ class ObjectCollectionTest extends CakeTestCase {
* @return void
*/
public function tearDown() {
unset($this->Objects);
parent::tearDown();
unset($this->Objects);
}
/**

View file

@ -127,6 +127,9 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
if (empty($this->_configure)) {
$this->_configure = Configure::read();
}
if (empty($this->_configure['App'])) {
fwrite(STDERR, get_class($this) . '::' . $this->getName() . " did not have any configure vars\n");
}
if (empty($this->_pathRestore)) {
$this->_pathRestore = App::paths();
}
@ -146,8 +149,10 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
if (class_exists('ClassRegistry', false)) {
ClassRegistry::flush();
}
Configure::clear();
Configure::write($this->_configure);
if (!empty($this->_configure)) {
Configure::clear();
Configure::write($this->_configure);
}
if (isset($_GET['debug']) && $_GET['debug']) {
ob_flush();
}