public function testConfigurationHelperWithoutConfigurationFromSetterAndWithoutOverrideFromCommandLineAndWithoutConfigInPath()
 {
     $this->input->expects($this->any())->method('getOption')->with('configuration')->will($this->returnValue(null));
     $configurationHelper = new ConfigurationHelper($this->connection, null);
     $migrationConfig = $configurationHelper->getMigrationConfig($this->input, $this->getOutputWriter());
     $this->assertInstanceOf('Doctrine\\DBAL\\Migrations\\Configuration\\Configuration', $migrationConfig);
     $this->assertStringMatchesFormat("", $this->getOutputStreamContent($this->output));
 }
Example #2
0
 protected function prepareOptions($publish = '', $config = '')
 {
     $this->inputMock->expects($this->any())->method('getOption')->will($this->returnCallback(function ($arg) use($publish, $config) {
         switch ($arg) {
             case 'publishPath':
                 return $publish;
             case 'configPath':
                 return $config;
         }
     }));
 }
 /**
  * @param string $cwd Current working directory
  * @param string $inputGet User specified path
  * @param bool $inputHas
  */
 protected function setupEnvironment($cwd, $inputGet, $inputHas = true)
 {
     $getcwd = $this->getFunctionMock('\\Phlib\\ConsoleConfiguration\\Helper', 'getcwd');
     $getcwd->expects($this->any())->will($this->returnValue($cwd));
     $this->input->expects($this->any())->method('hasOption')->will($this->returnValue($inputHas));
     $this->input->expects($this->any())->method('getOption')->will($this->returnValue($inputGet));
 }
Example #4
0
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  */
 protected function setUp()
 {
     parent::setUp();
     $this->prepareFolder();
     $this->inputMock = $this->getMock(InputInterface::class);
     $this->inputMock->expects($this->any())->method('isInteractive')->will($this->returnValue(true));
     $this->outputMock = $this->getMock(OutputInterface::class);
     $this->publisherScanner = new PublisherScanner();
     $this->publisherScanner->registerTypeHandler('php', \Dubpub\Publisher\Handlers\PHPHandler::class);
     $this->publisherScanner->registerTypeHandler('json', \Dubpub\Publisher\Handlers\JSONHandler::class);
     $this->publisherScanner->registerTypeHandler('ini', \Dubpub\Publisher\Handlers\INIHandler::class);
     $yamlHandler = new \Dubpub\Publisher\Handlers\YAMLHandler(new \Symfony\Component\Yaml\Parser(), new \Symfony\Component\Yaml\Dumper());
     $this->publisherScanner->registerTypeHandler('yml', $yamlHandler);
     $this->publisherScanner->registerTypeHandler('yaml', $yamlHandler);
     $this->testInstance = $this->getCommand($this->publisherScanner);
 }
 /**
  * Test quietness
  *
  * @dataProvider dataQuietness
  */
 public function testQuietness($quiet, $noInteraction, $confirmation, $countWriteln, $countDescriber, $countClient, $countExecute)
 {
     $this->input->expects($this->any())->method('getOption')->will($this->returnValueMap(array(array('quiet', $quiet), array('no-interaction', $noInteraction))));
     $this->questionHelper->expects($this->any())->method('ask')->will($this->returnValue($confirmation));
     $this->output->expects($countWriteln)->method('writeln');
     $this->gearmanDescriber->expects($countDescriber)->method('describeJob')->will($this->returnValue('olakase'));
     $this->gearmanClient->expects($countClient)->method('getJob')->will($this->returnValue(array()));
     $this->gearmanExecute->expects($countExecute)->method('executeJob');
     $this->command->setGearmanClient($this->gearmanClient)->setGearmanDescriber($this->gearmanDescriber)->setGearmanExecute($this->gearmanExecute)->setKernel($this->kernel)->run($this->input, $this->output);
 }
Example #6
0
 protected function prepareInput($badInput = false)
 {
     $this->inputMock->expects($this->any())->method('getArgument')->will($this->returnCallback(function () {
         switch ($agr = func_get_arg(0)) {
             case 'package':
             case 'group':
                 return '*';
             default:
                 var_dump($agr) || die;
         }
     }));
     $this->inputMock->expects($this->any())->method('getOption')->will($this->returnCallback(function () use($badInput) {
         switch ($agr = func_get_arg(0)) {
             case 'configPath':
             case 'publishPath':
                 return $badInput ? uniqid() : getcwd();
             default:
                 var_dump($agr) || die;
         }
     }));
 }
 /**
  * Test quietness
  *
  * @dataProvider dataQuietness
  */
 public function testQuietness($quiet, $countWriteln)
 {
     $this->input->expects($this->any())->method('getOption')->will($this->returnValueMap(array(array('quiet', $quiet))));
     $this->output->expects($countWriteln)->method('writeln');
     $this->command->setGearmanClient($this->gearmanClient)->setKernel($this->kernel)->run($this->input, $this->output);
 }
 /**
  * Test run without quietness
  */
 public function testRunNonQuiet()
 {
     $this->input->expects($this->any())->method('getOption')->will($this->returnValueMap(array(array('quiet', false))));
     $this->output->expects($this->any())->method('writeln');
     $this->command->run($this->input, $this->output);
 }