Fix failing test.

This commit is contained in:
mark_story 2012-04-09 21:46:38 -04:00
parent 67743c8079
commit 81208d1fa7

View file

@ -193,6 +193,8 @@ class HelperTest extends CakeTestCase {
* @return void * @return void
*/ */
public function setUp() { public function setUp() {
parent::setUp();
ClassRegistry::flush(); ClassRegistry::flush();
Router::reload(); Router::reload();
$null = null; $null = null;
@ -215,9 +217,11 @@ class HelperTest extends CakeTestCase {
* @return void * @return void
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown();
Configure::delete('Asset');
CakePlugin::unload(); CakePlugin::unload();
unset($this->Helper, $this->View); unset($this->Helper, $this->View);
ClassRegistry::flush();
} }
/** /**
@ -565,9 +569,7 @@ class HelperTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testAssetTimestamp() { public function testAssetTimestamp() {
$_timestamp = Configure::read('Asset.timestamp'); Configure::write('Foo.bar', 'test');
$_debug = Configure::read('debug');
Configure::write('Asset.timestamp', false); Configure::write('Asset.timestamp', false);
$result = $this->Helper->assetTimestamp(CSS_URL . 'cake.generic.css'); $result = $this->Helper->assetTimestamp(CSS_URL . 'cake.generic.css');
$this->assertEquals(CSS_URL . 'cake.generic.css', $result); $this->assertEquals(CSS_URL . 'cake.generic.css', $result);
@ -593,9 +595,6 @@ class HelperTest extends CakeTestCase {
$this->Helper->request->webroot = '/some/dir/'; $this->Helper->request->webroot = '/some/dir/';
$result = $this->Helper->assetTimestamp('/some/dir/' . CSS_URL . 'cake.generic.css'); $result = $this->Helper->assetTimestamp('/some/dir/' . CSS_URL . 'cake.generic.css');
$this->assertRegExp('/' . preg_quote(CSS_URL . 'cake.generic.css?', '/') . '[0-9]+/', $result); $this->assertRegExp('/' . preg_quote(CSS_URL . 'cake.generic.css?', '/') . '[0-9]+/', $result);
Configure::write('debug', $_debug);
Configure::write('Asset.timestamp', $_timestamp);
} }
/** /**
@ -605,8 +604,6 @@ class HelperTest extends CakeTestCase {
*/ */
public function testAssetUrl() { public function testAssetUrl() {
$this->Helper->webroot = ''; $this->Helper->webroot = '';
$_timestamp = Configure::read('Asset.timestamp');
$result = $this->Helper->assetUrl(array( $result = $this->Helper->assetUrl(array(
'controller' => 'js', 'controller' => 'js',
'action' => 'post', 'action' => 'post',
@ -666,7 +663,6 @@ class HelperTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testAssetTimestampPluginsAndThemes() { public function testAssetTimestampPluginsAndThemes() {
$timestamp = Configure::read('Asset.timestamp');
Configure::write('Asset.timestamp', 'force'); Configure::write('Asset.timestamp', 'force');
App::build(array( App::build(array(
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS), 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS),
@ -684,9 +680,6 @@ class HelperTest extends CakeTestCase {
$result = $this->Helper->assetTimestamp('/theme/test_theme/js/non_existant.js'); $result = $this->Helper->assetTimestamp('/theme/test_theme/js/non_existant.js');
$this->assertRegExp('#/theme/test_theme/js/non_existant.js\?$#', $result, 'No error on missing file'); $this->assertRegExp('#/theme/test_theme/js/non_existant.js\?$#', $result, 'No error on missing file');
App::build();
Configure::write('Asset.timestamp', $timestamp);
} }
/** /**