コード例 #1
0
ファイル: ModuleCommandTest.php プロジェクト: raphhh/samurai
 public function testExecuteInstall()
 {
     $executor = $this->getMock('TRex\\Cli\\Executor');
     $executor->expects($this->any())->method('flush')->will($this->returnValue(0));
     $questionHelper = $this->getMock('Symfony\\Component\\Console\\Helper\\QuestionHelper', array('ask'));
     $questionHelper->expects($this->any())->method('ask')->will($this->returnValue(true));
     $samurai = new Samurai(new Application(), $this->provideServices($executor, $questionHelper));
     $command = $samurai->getApplication()->find('module');
     $commandTester = new CommandTester($command);
     $commandTester->execute(['command' => $command->getName(), 'action' => 'install']);
     $this->assertContains("Starting modules installation\n", $commandTester->getDisplay(true));
 }
コード例 #2
0
ファイル: AliasCommandTest.php プロジェクト: raphhh/samurai
 /**
  * @depends testExecuteDeleteNoConfirm
  */
 public function testExecuteDeleteConfirm()
 {
     $questionHelper = $this->getMock('Symfony\\Component\\Console\\Helper\\QuestionHelper', array('ask'));
     $questionHelper->expects($this->at(0))->method('ask')->will($this->returnValue(true));
     $samurai = new Samurai(new Application(), $this->provideServices($questionHelper));
     $alias = $samurai->getServices()['alias_manager']->getLocal();
     $this->assertArrayHasKey('test', $alias);
     $command = $samurai->getApplication()->find('alias');
     $commandTester = new CommandTester($command);
     $commandTester->execute(['command' => $command->getName(), 'action' => 'rm', 'name' => 'test']);
     $alias = $samurai->getServices()['alias_manager']->getLocal();
     $this->assertArrayNotHasKey('test', $alias);
 }