Skip to content
Permalink
Browse files

Adding tests for loading plugin files.

  • Loading branch information...
markstory committed Jul 8, 2010
1 parent 457f24d commit 9804ed0cb3b57b56e172b4d3d70d51eb3a695b34
Showing with 10 additions and 30 deletions.
  1. +1 −1 cake/console/libs/task_collection.php
  2. +9 −29 cake/tests/cases/console/libs/task_collection.test.php
@@ -72,7 +72,7 @@ public function load($task, $settings = array(), $enable = true) {
*
* @param string $file Underscored name of the file to find missing .php
* @return string Filename to the task
* @throw MissingTaskFileException
* @throws MissingTaskFileException
*/
protected function _getPath($file) {
foreach ($this->_Dispatch->shellPaths as $path) {
@@ -94,15 +94,14 @@ function testLoadMissingTaskFile() {
* @return void
*/
function testLoadPluginTask() {
$this->markTestIncomplete('Not done');
App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
));
$dispatcher = $this->getMock('ShellDispatcher', array(), array(), '', false);
$dispatcher->shellPaths = App::path('shells');
$dispatcher->shellPaths[] = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'vendors' . DS . 'shells' . DS;
$this->Tasks = new TaskCollection($dispatcher);
$result = $this->Tasks->load('TestPlugin.OtherTask');
$this->assertType('OtherTaskTask', $result, 'Task class is wrong.');
$this->assertType('OtherTaskTask', $this->Tasks->OtherTask, 'Class is wrong');
App::build();
}
/**
@@ -111,39 +110,20 @@ function testLoadPluginTask() {
* @return void
*/
function testUnload() {
$this->markTestIncomplete('Not done');
$this->Tasks->load('Extract');
$this->Tasks->load('Fixture');
$this->Tasks->load('DbConfig');
$result = $this->Tasks->attached();
$this->assertEquals(array('Extract', 'Fixture'), $result, 'loaded tasks is wrong');
$this->assertEquals(array('Extract', 'DbConfig'), $result, 'loaded tasks is wrong');
$this->Tasks->unload('Fixture');
$this->assertFalse(isset($this->Tasks->Fixture));
$this->Tasks->unload('DbConfig');
$this->assertFalse(isset($this->Tasks->DbConfig));
$this->assertTrue(isset($this->Tasks->Extract));
$result = $this->Tasks->attached();
$this->assertEquals(array('Extract'), $result, 'loaded tasks is wrong');
}
/**
* test triggering callbacks.
*
* @return void
*/
function testTrigger() {
$this->markTestIncomplete('Not done');
}
/**
* test trigger and disabled tasks.
*
* @return void
*/
function testTriggerWithDisabledTasks() {
$this->markTestIncomplete('Not done');
}
/**
* test normalizeObjectArray
*

0 comments on commit 9804ed0

Please sign in to comment.
You can’t perform that action at this time.