Fixing some TestSuite tests

This commit is contained in:
Jose Lorenzo Rodriguez 2011-05-08 23:25:32 -04:30
parent 2fab0b0e1c
commit 2c3132fa85
6 changed files with 24 additions and 14 deletions

View file

@ -313,12 +313,14 @@ class Dispatcher {
$assetFile = $path . $fileFragment;
}
} else {
$plugin = $parts[0];
unset($parts[0]);
$fileFragment = implode(DS, $parts);
$pluginWebroot = App::pluginPath($plugin) . 'webroot' . DS;
if (file_exists($pluginWebroot . $fileFragment)) {
$assetFile = $pluginWebroot . $fileFragment;
$plugin = Inflector::camelize($parts[0]);
if (CakePlugin::loaded($plugin)) {
unset($parts[0]);
$fileFragment = implode(DS, $parts);
$pluginWebroot = CakePlugin::path($plugin) . 'webroot' . DS;
if (file_exists($pluginWebroot . $fileFragment)) {
$assetFile = $pluginWebroot . $fileFragment;
}
}
}

View file

@ -30,14 +30,12 @@ if (!empty($plugins)):
?>
<li style="padding-top: 10px">
<span style="font-size: 18px">Plugins</span>
<?php foreach($plugins as $plugin):
$pluginPath = Inflector::underscore($plugin);
?>
<?php foreach($plugins as $plugin): ?>
<ul>
<li style="padding-top: 10px">
<span style="font-size: 18px"><?php echo $plugin;?></span>
<ul>
<li><a href='<?php echo $cases;?>&amp;plugin=<?php echo $pluginPath; ?>'>Tests</a></li>
<li><a href='<?php echo $cases;?>&amp;plugin=<?php echo $plugin; ?>'>Tests</a></li>
</ul>
</li>
</ul>

View file

@ -27,6 +27,7 @@ class CakePluginTest extends CakeTestCase {
*/
public function tearDown() {
App::build();
CakePlugin::unload();
Configure::delete('CakePluginTest');
}

View file

@ -127,6 +127,7 @@ class ControllerTestCaseTest extends CakeTestCase {
'Model' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'Model' . DS),
'View' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'View' . DS)
));
CakePlugin::loadAll();
$this->Case = new ControllerTestCase();
Router::reload();
}
@ -138,6 +139,7 @@ class ControllerTestCaseTest extends CakeTestCase {
*/
function tearDown() {
parent::tearDown();
CakePlugin::unload();
$this->Case->controller = null;
}
@ -412,8 +414,9 @@ class ControllerTestCaseTest extends CakeTestCase {
'blue' => 'mana'
)
));
$this->assertTrue(isset($result['params']['url']['red']));
$this->assertTrue(isset($result['params']['url']['blue']));
$query = $this->Case->controller->request->query;
$this->assertTrue(isset($query['red']));
$this->assertTrue(isset($query['blue']));
}
/**

View file

@ -26,6 +26,10 @@ class HtmlCoverageReportTest extends CakeTestCase {
* @return void
*/
public function setUp() {
App::build(array(
'plugins' => array(CAKE . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
CakePlugin::loadAll();
$reporter = new CakeBaseReporter();
$reporter->params = array('app' => false, 'plugin' => false, 'group' => false);
$coverage = array();
@ -47,9 +51,9 @@ class HtmlCoverageReportTest extends CakeTestCase {
$this->assertEquals(ROOT . DS . APP_DIR . DS, $result);
$this->Coverage->appTest = false;
$this->Coverage->pluginTest = 'test_plugin';
$this->Coverage->pluginTest = 'TestPlugin';
$result = $this->Coverage->getPathFilter();
$this->assertEquals(ROOT . DS . APP_DIR . DS . 'plugins' . DS .'test_plugin' . DS, $result);
$this->assertEquals(CakePlugin::path('TestPlugin'), $result);
}
/**
@ -170,6 +174,7 @@ class HtmlCoverageReportTest extends CakeTestCase {
* @return void
*/
function tearDown() {
CakePlugin::unload();
unset($this->Coverage);
}
}

View file

@ -278,5 +278,6 @@ class ClassRegistryTest extends CakeTestCase {
$PluginUserCopy = ClassRegistry::getObject('RegistryPluginUser');
$this->assertTrue(is_a($PluginUserCopy, 'RegistryPluginAppModel'));
$this->assertSame($PluginUser, $PluginUserCopy);
CakePlugin::unload();
}
}