예제 #1
0
 /**
  * @return void
  */
 public function testExecuteCommand()
 {
     $outputDouble = $this->getMockBuilder('\\Symfony\\Component\\Console\\Output\\OutputInterface')->getMockForAbstractClass();
     $processDouble = $this->getMockBuilder('\\Symfony\\Component\\Process\\Process')->disableOriginalConstructor()->setMethods(array('setCommandLine', 'run', 'isSuccessful', 'getErrorOutput', 'getExitCode'))->getMock();
     $processDouble->expects($this->once())->method('run');
     $processDouble->expects($this->once())->method('isSuccessful')->willReturn(false);
     $kernelDouble = $this->getMock('\\Symfony\\Component\\HttpKernel\\KernelInterface');
     $kernelDouble->expects($this->once())->method('getRootDir')->willReturn('/app');
     $runner = new CommandRunner($kernelDouble, $processDouble);
     $this->setExpectedException('\\RuntimeException');
     $runner->executeCommand(array('graviton:test:command'), $outputDouble, 'test mesage');
 }
 /**
  * Generates a Bundle via command line (wrapping graviton:generate:bundle)
  *
  * @param string          $namespace  Namespace
  * @param string          $bundleName Name of bundle
  * @param InputInterface  $input      Input
  * @param OutputInterface $output     Output
  *
  * @return void
  *
  * @throws \LogicException
  */
 private function generateBundle($namespace, $bundleName, InputInterface $input, OutputInterface $output)
 {
     // first, create the bundle
     $arguments = array('graviton:generate:bundle', '--namespace' => $namespace, '--bundle-name' => $bundleName, '--dir' => $input->getOption('srcDir'), '--format' => $input->getOption('bundleFormat'), '--doUpdateKernel' => 'false', '--loaderBundleName' => $input->getOption('bundleBundleName'), '--structure' => null);
     $this->runner->executeCommand($arguments, $output, 'Create bundle call failed, see above. Exiting.');
 }