コード例 #1
0
ファイル: DatabaseUpdateCommand.php プロジェクト: itkg/core
 /**
  * Execute command
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @throws \RuntimeException
  * @throws \LogicException
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->setup->getLocator()->setParams(array('release' => $input->getArgument('release'), 'path' => $input->getOption('path'), 'scriptName' => $input->getOption('script')));
     $queries = $this->setup($input);
     $this->display($input, $output, $queries);
 }
コード例 #2
0
ファイル: SetupTest.php プロジェクト: itkg/core
 /**
  * @expectedException \Exception
  */
 public function testRunWithExecuteException()
 {
     $connectionMock = $this->getMockBuilder('\\Doctrine\\DBAL\\Connection')->disableOriginalConstructor()->setMethods(array('executeQuery', 'connect'))->getMock();
     $connectionMock->expects($this->any())->method('executeQuery')->will($this->throwException(new \Exception('Failed')));
     $loader = new Loader($connectionMock);
     $runner = new Runner($connectionMock);
     $factory = new Factory();
     $locator = new Locator();
     $decorator = new Decorator(new \Itkg\Core\Command\DatabaseUpdate\Template\Loader());
     $setup = new Setup($runner, $loader, $factory, $locator, $decorator, new ReleaseChecker());
     $setup->getLocator()->setParams(array('path' => TEST_BASE_DIR, 'release' => 'data'));
     $setup->setExecuteQueries(true);
     $setup->run();
 }