/** * @param InputInterface $input * @param OutputInterface $output * * @return int|null * * @throws \Exception */ protected function execute(InputInterface $input, OutputInterface $output) { $testsuite = null; if ($input->getOption('testsuite')) { $testsuite = $input->getOption('testsuite'); } $config = $this->configuration['PARAUNIT_PHPUNIT_XML_PATH']; if ($input->getOption('configuration')) { $config = $input->getOption('configuration'); } $pNumber = $this->configuration['PARAUNIT_MAX_PROCESS_NUMBER']; if ($input->getOption('configuration')) { $pNumber = $input->getOption('configuration'); } $testArray = $this->filter->filterTestFiles($config, $testsuite); $this->runner->setMaxProcessNumber($pNumber); $this->runner->setPhpunitConfigFile($config); if ($input->getOption('debug')) { $this->runner->enableDebugMode(); } return $this->runner->run($testArray, $output); }
public function testFilterTestFiles_supports_file_nodes() { $configFile = $this->absoluteConfigBaseDir . 'stubbed_for_node_file.xml'; $utilXml = $this->prophesize(static::PHPUNIT_UTIL_XML_PROXY_CLASS); $utilXml->loadFile($configFile, false, true, true)->willReturn($this->getStubbedXMLConf($configFile))->shouldBeCalled(); $file1 = $this->absoluteConfigBaseDir . './only/selected/test/suite/TestPrefixOneTest.php'; $file2 = $this->absoluteConfigBaseDir . './other/test/suite/OtherTest.php'; $fileIterator = $this->prophesize(static::FILE_ITERATOR_FACADE_CLASS); $fileIterator->getFilesAsArray($this->absoluteConfigBaseDir . './only/selected/test/suite/', 'Test.php', '', array())->willReturn(array($file1))->shouldBeCalledTimes(1); $fileIterator->getFilesAsArray($this->absoluteConfigBaseDir . './other/test/suite/', 'Test.php', '', array())->willReturn(array($file2))->shouldBeCalledTimes(1); $filter = new Filter($utilXml->reveal(), $fileIterator->reveal()); $result = $filter->filterTestFiles($configFile); $this->assertEquals(array($file1, $this->absoluteConfigBaseDir . './this/file.php', $this->absoluteConfigBaseDir . './this/file2.php', $file2), $result); }