mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Added missing calls to setUp & tearDown in tests
This commit is contained in:
parent
4590b7d553
commit
1cac1846a3
17 changed files with 26 additions and 0 deletions
|
@ -34,6 +34,7 @@ class RedisEngineTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->skipIf(!class_exists('Redis'), 'Redis is not installed or configured properly.');
|
||||
|
||||
$this->_cacheDisable = Configure::read('Cache.disable');
|
||||
|
@ -51,6 +52,7 @@ class RedisEngineTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
Configure::write('Cache.disable', $this->_cacheDisable);
|
||||
Cache::drop('');
|
||||
Cache::drop('redis_groups');
|
||||
|
|
|
@ -72,6 +72,7 @@ class CookieComponentTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$_COOKIE = array();
|
||||
$this->Controller = new CookieComponentTestController(new CakeRequest(), new CakeResponse());
|
||||
$this->Controller->constructClasses();
|
||||
|
@ -93,6 +94,7 @@ class CookieComponentTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
$this->Cookie->destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -226,6 +226,7 @@ class AclBehaviorTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testSetup() {
|
||||
parent::setUp();
|
||||
$User = new AclUser();
|
||||
$this->assertTrue(isset($User->Behaviors->Acl->settings['User']));
|
||||
$this->assertEquals('requester', $User->Behaviors->Acl->settings['User']['type']);
|
||||
|
|
|
@ -62,6 +62,7 @@ class MysqlTest extends CakeTestCase {
|
|||
*
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->Dbo = ConnectionManager::getDataSource('test');
|
||||
if (!($this->Dbo instanceof Mysql)) {
|
||||
$this->markTestSkipped('The MySQL extension is not available.');
|
||||
|
@ -76,6 +77,7 @@ class MysqlTest extends CakeTestCase {
|
|||
*
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
unset($this->model);
|
||||
ClassRegistry::flush();
|
||||
Configure::write('debug', $this->_debug);
|
||||
|
|
|
@ -215,6 +215,7 @@ class PostgresTest extends CakeTestCase {
|
|||
*
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
Configure::write('Cache.disable', true);
|
||||
$this->Dbo = ConnectionManager::getDataSource('test');
|
||||
$this->skipIf(!($this->Dbo instanceof Postgres));
|
||||
|
@ -227,6 +228,7 @@ class PostgresTest extends CakeTestCase {
|
|||
*
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
Configure::write('Cache.disable', false);
|
||||
unset($this->Dbo2);
|
||||
}
|
||||
|
|
|
@ -266,6 +266,7 @@ class SqlserverTest extends CakeTestCase {
|
|||
*
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->Dbo = ConnectionManager::getDataSource('test');
|
||||
if (!($this->Dbo instanceof Sqlserver)) {
|
||||
$this->markTestSkipped('Please configure the test datasource to use SQL Server.');
|
||||
|
@ -280,6 +281,7 @@ class SqlserverTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
unset($this->Dbo);
|
||||
unset($this->model);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ class DebugTransportTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->DebugTransport = new DebugTransport();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ class MailTransportTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->MailTransport = $this->getMock('MailTransport', array('_mail'));
|
||||
$this->MailTransport->config(array('additionalParameters' => '-f'));
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ class SmtpTransportTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
if (!class_exists('MockSocket')) {
|
||||
$this->getMock('CakeSocket', array('read', 'write', 'connect', 'enableCrypto'), array(), 'MockSocket');
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ class DigestAuthenticationTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->HttpSocket = new DigestHttpSocket();
|
||||
$this->HttpSocket->request['method'] = 'GET';
|
||||
$this->HttpSocket->request['uri']['path'] = '/';
|
||||
|
@ -84,6 +85,7 @@ class DigestAuthenticationTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
unset($this->HttpSocket);
|
||||
}
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ class HttpResponseTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->HttpResponse = new TestHttpResponse();
|
||||
}
|
||||
|
||||
|
|
|
@ -193,6 +193,7 @@ class HttpSocketTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
if (!class_exists('MockHttpSocket')) {
|
||||
$this->getMock('TestHttpSocket', array('read', 'write', 'connect'), array(), 'MockHttpSocket');
|
||||
$this->getMock('TestHttpSocket', array('read', 'write', 'connect', 'request'), array(), 'MockHttpSocketRequests');
|
||||
|
@ -208,6 +209,7 @@ class HttpSocketTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
unset($this->Socket, $this->RequestSocket);
|
||||
}
|
||||
|
||||
|
|
|
@ -511,6 +511,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->_get = $_GET;
|
||||
$_GET = array();
|
||||
$this->_post = $_POST;
|
||||
|
@ -538,6 +539,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
$_GET = $this->_get;
|
||||
$_POST = $this->_post;
|
||||
$_FILES = $this->_files;
|
||||
|
|
|
@ -30,6 +30,7 @@ class AssetDispatcherTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
Configure::write('Dispatcher.filters', array());
|
||||
}
|
||||
|
||||
|
|
|
@ -189,6 +189,7 @@ class CakeTestFixtureTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$methods = array_diff(get_class_methods('DboSource'), array('enabled'));
|
||||
$methods[] = 'connect';
|
||||
|
||||
|
@ -204,6 +205,7 @@ class CakeTestFixtureTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
unset($this->criticDb);
|
||||
$this->db->config = $this->_backupConfig;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ class CakeTimeTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
unset($this->Time);
|
||||
$this->_restoreSystemTimezone();
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
unset($this->View, $this->Paginator);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue