Added missing calls to setUp & tearDown in tests

This commit is contained in:
Marc Würth 2013-07-29 01:22:52 +02:00
parent 4590b7d553
commit 1cac1846a3
17 changed files with 26 additions and 0 deletions

View file

@ -34,6 +34,7 @@ class RedisEngineTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
parent::setUp();
$this->skipIf(!class_exists('Redis'), 'Redis is not installed or configured properly.'); $this->skipIf(!class_exists('Redis'), 'Redis is not installed or configured properly.');
$this->_cacheDisable = Configure::read('Cache.disable'); $this->_cacheDisable = Configure::read('Cache.disable');
@ -51,6 +52,7 @@ class RedisEngineTest extends CakeTestCase {
* @return void * @return void
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
Configure::write('Cache.disable', $this->_cacheDisable); Configure::write('Cache.disable', $this->_cacheDisable);
Cache::drop(''); Cache::drop('');
Cache::drop('redis_groups'); Cache::drop('redis_groups');

View file

@ -72,6 +72,7 @@ class CookieComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
parent::setUp();
$_COOKIE = array(); $_COOKIE = array();
$this->Controller = new CookieComponentTestController(new CakeRequest(), new CakeResponse()); $this->Controller = new CookieComponentTestController(new CakeRequest(), new CakeResponse());
$this->Controller->constructClasses(); $this->Controller->constructClasses();
@ -93,6 +94,7 @@ class CookieComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
$this->Cookie->destroy(); $this->Cookie->destroy();
} }

View file

@ -226,6 +226,7 @@ class AclBehaviorTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testSetup() { public function testSetup() {
parent::setUp();
$User = new AclUser(); $User = new AclUser();
$this->assertTrue(isset($User->Behaviors->Acl->settings['User'])); $this->assertTrue(isset($User->Behaviors->Acl->settings['User']));
$this->assertEquals('requester', $User->Behaviors->Acl->settings['User']['type']); $this->assertEquals('requester', $User->Behaviors->Acl->settings['User']['type']);

View file

@ -62,6 +62,7 @@ class MysqlTest extends CakeTestCase {
* *
*/ */
public function setUp() { public function setUp() {
parent::setUp();
$this->Dbo = ConnectionManager::getDataSource('test'); $this->Dbo = ConnectionManager::getDataSource('test');
if (!($this->Dbo instanceof Mysql)) { if (!($this->Dbo instanceof Mysql)) {
$this->markTestSkipped('The MySQL extension is not available.'); $this->markTestSkipped('The MySQL extension is not available.');
@ -76,6 +77,7 @@ class MysqlTest extends CakeTestCase {
* *
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
unset($this->model); unset($this->model);
ClassRegistry::flush(); ClassRegistry::flush();
Configure::write('debug', $this->_debug); Configure::write('debug', $this->_debug);

View file

@ -215,6 +215,7 @@ class PostgresTest extends CakeTestCase {
* *
*/ */
public function setUp() { public function setUp() {
parent::setUp();
Configure::write('Cache.disable', true); Configure::write('Cache.disable', true);
$this->Dbo = ConnectionManager::getDataSource('test'); $this->Dbo = ConnectionManager::getDataSource('test');
$this->skipIf(!($this->Dbo instanceof Postgres)); $this->skipIf(!($this->Dbo instanceof Postgres));
@ -227,6 +228,7 @@ class PostgresTest extends CakeTestCase {
* *
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
Configure::write('Cache.disable', false); Configure::write('Cache.disable', false);
unset($this->Dbo2); unset($this->Dbo2);
} }

View file

@ -266,6 +266,7 @@ class SqlserverTest extends CakeTestCase {
* *
*/ */
public function setUp() { public function setUp() {
parent::setUp();
$this->Dbo = ConnectionManager::getDataSource('test'); $this->Dbo = ConnectionManager::getDataSource('test');
if (!($this->Dbo instanceof Sqlserver)) { if (!($this->Dbo instanceof Sqlserver)) {
$this->markTestSkipped('Please configure the test datasource to use SQL Server.'); $this->markTestSkipped('Please configure the test datasource to use SQL Server.');
@ -280,6 +281,7 @@ class SqlserverTest extends CakeTestCase {
* @return void * @return void
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
unset($this->Dbo); unset($this->Dbo);
unset($this->model); unset($this->model);
} }

View file

@ -34,6 +34,7 @@ class DebugTransportTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
parent::setUp();
$this->DebugTransport = new DebugTransport(); $this->DebugTransport = new DebugTransport();
} }

View file

@ -34,6 +34,7 @@ class MailTransportTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
parent::setUp();
$this->MailTransport = $this->getMock('MailTransport', array('_mail')); $this->MailTransport = $this->getMock('MailTransport', array('_mail'));
$this->MailTransport->config(array('additionalParameters' => '-f')); $this->MailTransport->config(array('additionalParameters' => '-f'));
} }

View file

@ -82,6 +82,7 @@ class SmtpTransportTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
parent::setUp();
if (!class_exists('MockSocket')) { if (!class_exists('MockSocket')) {
$this->getMock('CakeSocket', array('read', 'write', 'connect', 'enableCrypto'), array(), 'MockSocket'); $this->getMock('CakeSocket', array('read', 'write', 'connect', 'enableCrypto'), array(), 'MockSocket');
} }

View file

@ -73,6 +73,7 @@ class DigestAuthenticationTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
parent::setUp();
$this->HttpSocket = new DigestHttpSocket(); $this->HttpSocket = new DigestHttpSocket();
$this->HttpSocket->request['method'] = 'GET'; $this->HttpSocket->request['method'] = 'GET';
$this->HttpSocket->request['uri']['path'] = '/'; $this->HttpSocket->request['uri']['path'] = '/';
@ -84,6 +85,7 @@ class DigestAuthenticationTest extends CakeTestCase {
* @return void * @return void
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
unset($this->HttpSocket); unset($this->HttpSocket);
} }

View file

@ -93,6 +93,7 @@ class HttpResponseTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
parent::setUp();
$this->HttpResponse = new TestHttpResponse(); $this->HttpResponse = new TestHttpResponse();
} }

View file

@ -193,6 +193,7 @@ class HttpSocketTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
parent::setUp();
if (!class_exists('MockHttpSocket')) { if (!class_exists('MockHttpSocket')) {
$this->getMock('TestHttpSocket', array('read', 'write', 'connect'), array(), 'MockHttpSocket'); $this->getMock('TestHttpSocket', array('read', 'write', 'connect'), array(), 'MockHttpSocket');
$this->getMock('TestHttpSocket', array('read', 'write', 'connect', 'request'), array(), 'MockHttpSocketRequests'); $this->getMock('TestHttpSocket', array('read', 'write', 'connect', 'request'), array(), 'MockHttpSocketRequests');
@ -208,6 +209,7 @@ class HttpSocketTest extends CakeTestCase {
* @return void * @return void
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
unset($this->Socket, $this->RequestSocket); unset($this->Socket, $this->RequestSocket);
} }

View file

@ -511,6 +511,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
parent::setUp();
$this->_get = $_GET; $this->_get = $_GET;
$_GET = array(); $_GET = array();
$this->_post = $_POST; $this->_post = $_POST;
@ -538,6 +539,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
$_GET = $this->_get; $_GET = $this->_get;
$_POST = $this->_post; $_POST = $this->_post;
$_FILES = $this->_files; $_FILES = $this->_files;

View file

@ -30,6 +30,7 @@ class AssetDispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
Configure::write('Dispatcher.filters', array()); Configure::write('Dispatcher.filters', array());
} }

View file

@ -189,6 +189,7 @@ class CakeTestFixtureTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
parent::setUp();
$methods = array_diff(get_class_methods('DboSource'), array('enabled')); $methods = array_diff(get_class_methods('DboSource'), array('enabled'));
$methods[] = 'connect'; $methods[] = 'connect';
@ -204,6 +205,7 @@ class CakeTestFixtureTest extends CakeTestCase {
* @return void * @return void
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
unset($this->criticDb); unset($this->criticDb);
$this->db->config = $this->_backupConfig; $this->db->config = $this->_backupConfig;
} }

View file

@ -52,6 +52,7 @@ class CakeTimeTest extends CakeTestCase {
* @return void * @return void
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
unset($this->Time); unset($this->Time);
$this->_restoreSystemTimezone(); $this->_restoreSystemTimezone();
} }

View file

@ -79,6 +79,7 @@ class PaginatorHelperTest extends CakeTestCase {
* @return void * @return void
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
unset($this->View, $this->Paginator); unset($this->View, $this->Paginator);
} }