mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Removing a dead test and adding tests for hasTask
This commit is contained in:
parent
830238c2dd
commit
18c5a62445
2 changed files with 37 additions and 5 deletions
|
@ -288,6 +288,26 @@ class Shell extends Object {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if this shell has a task with the provided name.
|
||||
*
|
||||
* @param string $task The task name to check.
|
||||
* @return boolean Success
|
||||
*/
|
||||
public function hasTask($task) {
|
||||
return isset($this->_taskMap[Inflector::camelize($task)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if this shell has a callable method by the given name.
|
||||
*
|
||||
* @param string $name The method name to check.
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasMethod($name) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload get for lazy building of tasks
|
||||
*
|
||||
|
|
|
@ -161,11 +161,6 @@ class ShellTest extends CakeTestCase {
|
|||
$this->assertIsA($this->Shell->Comment, 'Comment');
|
||||
$this->assertEqual($this->Shell->modelClass, 'Comment');
|
||||
|
||||
$this->Shell->uses = true;
|
||||
$this->Shell->initialize();
|
||||
$this->assertTrue(isset($this->Shell->AppModel));
|
||||
$this->assertIsA($this->Shell->AppModel, 'AppModel');
|
||||
|
||||
App::build();
|
||||
}
|
||||
|
||||
|
@ -566,4 +561,21 @@ class ShellTest extends CakeTestCase {
|
|||
|
||||
$Folder->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* test hasTask method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testHasTask() {
|
||||
$this->Shell->tasks = array('Extract', 'DbConfig');
|
||||
$this->Shell->loadTasks();
|
||||
|
||||
$this->assertTrue($this->Shell->hasTask('extract'));
|
||||
$this->assertTrue($this->Shell->hasTask('Extract'));
|
||||
$this->assertFalse($this->Shell->hasTask('random'));
|
||||
|
||||
$this->assertTrue($this->Shell->hasTask('db_config'));
|
||||
$this->assertTrue($this->Shell->hasTask('DbConfig'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue