Skip to content

Commit

Permalink
Adding tests for loading plugin files.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 11, 2010
1 parent 457f24d commit 9804ed0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cake/console/libs/task_collection.php
Expand Up @@ -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) {
Expand Down
38 changes: 9 additions & 29 deletions cake/tests/cases/console/libs/task_collection.test.php
Expand Up @@ -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();
}

/**
Expand All @@ -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
*
Expand Down

0 comments on commit 9804ed0

Please sign in to comment.