Esempio n. 1
0
 /**
  * Shorthand for more descriptive CLI command testing
  * @param string $command full command string to be called
  * @return string
  */
 protected function runCliAction($command)
 {
     $this->bootstrap->setArguments(str_getcsv($command, ' '));
     ob_start();
     $this->bootstrap->setup()->run();
     $result = ob_get_contents();
     ob_end_clean();
     return $result;
 }
Esempio n. 2
0
 public function testShouldThrowExceptionAboutNotExistingModuleTask()
 {
     $cli = new Bootstrap($this->di->get('config'));
     $cli->setup();
     //remove Test module
     $application = $cli->getApplication();
     $modules = $application->getModules();
     $modulesWithoutTest = array_merge([], $modules);
     unset($modulesWithoutTest['Test']);
     $application->registerModules($modulesWithoutTest);
     $cli->setArguments(array(0 => 'cli/cli.php', 1 => 'app:test:foo', 2 => 'test'));
     $exception = null;
     try {
         $cli->run();
     } catch (\Exception $e) {
         $exception = $e;
     }
     $this->assertInstanceOf('Vegas\\Cli\\Exception\\TaskNotFoundException', $exception);
     $application->registerModules($modules);
 }