コード例 #1
0
ファイル: ManagerTest.php プロジェクト: azema/phigrate
 /**
  */
 public function testHelp()
 {
     // Set directory of tasks
     $path = PHIGRATE_BASE . '/library/Task';
     $this->object->setDirectoryOfTasks($path, true);
     $task = new taskMock();
     $taskName = 'my:task';
     $this->object->registerTask($taskName, $task);
     $this->assertTrue($this->object->hasTask($taskName));
     $this->assertInstanceOf('Phigrate_Task_ITask', $this->object->getTask($taskName));
     $help = $this->object->help($taskName);
     $this->assertInternalType('string', $help);
     $expected = 'my help task';
     $this->assertEquals($expected, $help);
 }
コード例 #2
0
ファイル: FrameworkRunner.php プロジェクト: azema/phigrate
 /**
  * execute
  *
  * @return void
  */
 public function execute()
 {
     $this->_logger->debug(__METHOD__ . ' Start');
     $output = '';
     if ($this->_curTaskName != 'db:export') {
         $output = $this->_getHeaderScript();
     }
     if ($this->_taskMgr->hasTask($this->_curTaskName)) {
         if ($this->_helpTask) {
             $output .= $this->_taskMgr->help($this->_curTaskName);
         } else {
             $output .= $this->_taskMgr->execute($this->_curTaskName, $this->_taskOptions);
         }
     } else {
         $msg = 'Task not found: ' . $this->_curTaskName;
         $this->_logger->err($msg);
         require_once 'Phigrate/Exception/InvalidTask.php';
         throw new Phigrate_Exception_InvalidTask($msg);
     }
     $this->_logger->debug(__METHOD__ . ' End');
     return $output;
 }