Esempio n. 1
0
 public function testShouldPropagateCustomOptionsIntoProcess()
 {
     $this->input = new StringInput('trolling chrome' . ' --' . RunCommand::OPTION_SERVER_URL . '=http://foo.bar:1337' . ' --' . RunCommand::OPTION_FIXTURES_DIR . '=custom-fixtures-dir/' . ' --' . RunCommand::OPTION_LOGS_DIR . '=custom-logs-dir/' . ' --' . RunCommand::OPTION_PUBLISH_RESULTS);
     $this->input->bind($this->command->getDefinition());
     // Redeclare creator so it uses the new input
     $this->creator = new ProcessSetCreator($this->command, $this->input, $this->bufferedOutput, $this->publisherMock);
     $files = $this->findDummyTests('DummyTest.php');
     // find only one file (we don't need more for the test)
     $processSet = $this->creator->createFromFiles($files, [], []);
     /** @var Process $process */
     $process = $processSet->get(ProcessSet::PROCESS_STATUS_QUEUED)[self::NAME_DUMMY_TEST]->process;
     $processEnv = $process->getEnv();
     $this->assertArraySubset(['BROWSER_NAME' => 'chrome', 'ENV' => 'trolling', 'SERVER_URL' => 'http://foo.bar:1337', 'PUBLISH_RESULTS' => '1', 'FIXTURES_DIR' => 'custom-fixtures-dir/', 'LOGS_DIR' => 'custom-logs-dir/'], $processEnv);
 }
Esempio n. 2
0
 /**
  * @dataProvider inputProvider
  * @param string $stringInput
  * @param string $expectedIdeKey
  */
 public function testShouldGetIdeKeyFromCommandOptionOnCommandInitialization($stringInput, $expectedIdeKey)
 {
     $this->mockXdebugExtension($isExtensionLoaded = true, $isRemoteEnabled = true);
     $command = new RunCommand(new EventDispatcher());
     $input = new StringInput($stringInput);
     $output = new BufferedOutput();
     $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
     // Trigger event to add the xdebug option to the command and bind the definition to the input
     $this->listener->onCommandConfigure(new BasicConsoleEvent($command));
     $input->bind($command->getDefinition());
     // Trigger command initialization event
     $event = new ExtendedConsoleEvent($command, $input, $output);
     $this->listener->onCommandRunTestsInit($event);
     if ($expectedIdeKey !== null) {
         $this->assertContains('Xdebug remote debugging initialized with IDE key: ' . $expectedIdeKey, $output->fetch());
     } else {
         // no output expected (xdebug not triggered)
         $this->assertEmpty($output->fetch());
     }
 }