public function test_behat_command_added_to_config_if_phpunit_is_installed()
 {
     $this->packageHelper->method('hasPackage')->willReturnMap([['behat/behat', null, $this->input, $this->output, true]]);
     $this->questionHelper->method('confirmRunBehat')->willReturn(true);
     $actual = $this->sut->createConfig($this->input, $this->output);
     self::assertContains('vendor/bin/behat', $actual->getScript());
 }
 public function test_do_not_write_file_when_file_already_exists_and_user_cancels_overwrite()
 {
     file_put_contents($this->configPath, $expected = 'StuffAndThings');
     $this->questionHelper->method('confirmOverwriteFile')->willReturn(false);
     $this->configBuilder->method('createConfig')->willReturn(new Config());
     $actual = $this->sut->run($this->input, $this->output);
     self::assertEquals(0, $actual);
     self::assertFileExists($this->configPath);
     self::assertEquals($expected, file_get_contents($this->configPath));
 }
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null
  * @throws \Symfony\Component\Console\Exception\InvalidArgumentException
  * @throws \Symfony\Component\Console\Exception\RuntimeException
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var PathHelper $pathHelper */
     $pathHelper = $this->getHelper('path');
     $configPath = $pathHelper->getPath('.travis.yml');
     if (file_exists($configPath)) {
         $shouldOverwrite = $this->questionHelper->confirmOverwriteFile($input, $output, $configPath);
         if (!$shouldOverwrite) {
             return 0;
         }
     }
     $config = $this->configBuilder->createConfig($input, $output);
     $this->configWriter->toYmlFile($config, $configPath);
     return 0;
 }