Fixing failing tests in group context caused by state being stuck in static objects.

This commit is contained in:
mark_story 2010-09-21 22:16:33 -04:00
parent 3e6b65557b
commit 5c94bdd028
3 changed files with 17 additions and 20 deletions

View file

@ -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']);
}

View file

@ -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));

View file

@ -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'));