mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fixing failing tests in group context caused by state being stuck in static objects.
This commit is contained in:
parent
3e6b65557b
commit
5c94bdd028
3 changed files with 17 additions and 20 deletions
9
cake/tests/cases/libs/cache/file.test.php
vendored
9
cake/tests/cases/libs/cache/file.test.php
vendored
|
@ -38,12 +38,12 @@ class FileEngineTest extends CakeTestCase {
|
|||
public $config = array();
|
||||
|
||||
/**
|
||||
* startCase method
|
||||
* setUp method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function startCase() {
|
||||
function setUp() {
|
||||
$this->_cacheDisable = Configure::read('Cache.disable');
|
||||
$this->_cacheConfig = Cache::config('default');
|
||||
Configure::write('Cache.disable', false);
|
||||
|
@ -51,12 +51,13 @@ class FileEngineTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* endCase method
|
||||
* teardown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function endCase() {
|
||||
function tearDown() {
|
||||
Cache::clear(false, 'default');
|
||||
Configure::write('Cache.disable', $this->_cacheDisable);
|
||||
Cache::config('default', $this->_cacheConfig['settings']);
|
||||
}
|
||||
|
|
|
@ -40,16 +40,8 @@ class ConfigureTest extends CakeTestCase {
|
|||
$this->_debug = Configure::read('debug');
|
||||
|
||||
Configure::write('Cache.disable', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* endTest
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function endTest() {
|
||||
App::build();
|
||||
App::objects('plugin', null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -397,27 +389,27 @@ class AppImportTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testListObjects() {
|
||||
$result = App::objects('class', TEST_CAKE_CORE_INCLUDE_PATH . 'libs');
|
||||
$result = App::objects('class', TEST_CAKE_CORE_INCLUDE_PATH . 'libs', false);
|
||||
$this->assertTrue(in_array('Xml', $result));
|
||||
$this->assertTrue(in_array('Cache', $result));
|
||||
$this->assertTrue(in_array('HttpSocket', $result));
|
||||
|
||||
$result = App::objects('behavior');
|
||||
$result = App::objects('behavior', null, false);
|
||||
$this->assertTrue(in_array('Tree', $result));
|
||||
|
||||
$result = App::objects('controller');
|
||||
$result = App::objects('controller', null, false);
|
||||
$this->assertTrue(in_array('Pages', $result));
|
||||
|
||||
$result = App::objects('component');
|
||||
$result = App::objects('component', null, false);
|
||||
$this->assertTrue(in_array('Auth', $result));
|
||||
|
||||
$result = App::objects('view');
|
||||
$result = App::objects('view', null, false);
|
||||
$this->assertTrue(in_array('Media', $result));
|
||||
|
||||
$result = App::objects('helper');
|
||||
$result = App::objects('helper', null, false);
|
||||
$this->assertTrue(in_array('Html', $result));
|
||||
|
||||
$result = App::objects('model');
|
||||
$result = App::objects('model', null, false);
|
||||
$notExpected = array('AppModel', 'ModelBehavior', 'ConnectionManager', 'DbAcl', 'Model', 'CakeSchema');
|
||||
foreach ($notExpected as $class) {
|
||||
$this->assertFalse(in_array($class, $result));
|
||||
|
|
|
@ -451,6 +451,8 @@ class ControllerTest extends CakeTestCase {
|
|||
*/
|
||||
function setUp() {
|
||||
App::objects('plugin', null, false);
|
||||
App::build();
|
||||
Router::reload();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -866,6 +868,8 @@ class ControllerTest extends CakeTestCase {
|
|||
*/
|
||||
function testFlash() {
|
||||
$request = new CakeRequest('controller_posts/index');
|
||||
$request->webroot = '/';
|
||||
$request->base = '/';
|
||||
|
||||
$Controller = new Controller($request);
|
||||
$Controller->response = $this->getMock('CakeResponse', array('_sendHeader'));
|
||||
|
|
Loading…
Add table
Reference in a new issue