|
|
@@ -1066,7 +1066,7 @@ TEXT;
|
|
|
$task->io($io);
|
|
|
$task->expects($this->once())
|
|
|
->method('runCommand')
|
|
|
- ->with(['one'], false);
|
|
|
+ ->with(['one'], false, ['requested' => true]);
|
|
|
|
|
|
$shell->expects($this->once())->method('getOptionParser')
|
|
|
->will($this->returnValue($parser));
|
|
|
@@ -1081,6 +1081,41 @@ TEXT;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * test that runCommand will invoke a task
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testRunCommandInvokeTask()
|
|
|
+ {
|
|
|
+ $parser = new ConsoleOptionParser('knife');
|
|
|
+ $parser->addSubcommand('slice');
|
|
|
+ $io = $this->getMock('Cake\Console\ConsoleIo');
|
|
|
+
|
|
|
+ $shell = $this->getMock('Cake\Console\Shell', ['hasTask', 'getOptionParser'], [$io]);
|
|
|
+ $task = $this->getMock('Cake\Console\Shell', ['main', '_welcome'], [$io]);
|
|
|
+
|
|
|
+ $shell->expects($this->once())
|
|
|
+ ->method('getOptionParser')
|
|
|
+ ->will($this->returnValue($parser));
|
|
|
+
|
|
|
+ $shell->expects($this->any())
|
|
|
+ ->method('hasTask')
|
|
|
+ ->will($this->returnValue(true));
|
|
|
+
|
|
|
+ $task->expects($this->never())
|
|
|
+ ->method('_welcome');
|
|
|
+
|
|
|
+ // One welcome message output.
|
|
|
+ $io->expects($this->at(2))
|
|
|
+ ->method('out')
|
|
|
+ ->with($this->stringContains('Welcome to CakePHP'));
|
|
|
+
|
|
|
+ $shell->Slice = $task;
|
|
|
+ $shell->runCommand(['slice', 'one']);
|
|
|
+ $this->assertTrue($task->params['requested'], 'Task is requested, no welcome.');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* test wrapBlock wrapping text.
|
|
|
*
|
|
|
* @return void
|