diff --git a/README.md b/README.md index c6ce12dd..249e9f6f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Paraunit is a tool for faster executions of PHPUnit test suites. It makes this p Paraunit is developed using Symfony2 components. ## Requirements -Paraunit reads PHPUnit's .xml configuration file, so it's needed to know which test to load; if you have colored output in your xml config, you should disable it, to avoid parsing problems. +Paraunit reads PHPUnit's .xml configuration file, so it's needed to know which test to load. If you are testing a Symfony2+Doctrine application, it's suggested to use also [facile-it/paraunit-testcase](https://github.com/facile-it/paraunit-testcase), to avoid database concurrency problems during functional testing. diff --git a/composer.json b/composer.json index 3e1f1ca0..029717d3 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "symfony/config": ">=2.3,<3", "symfony/process": ">=2.3,<3", "symfony/event-dispatcher": ">=2.3,<3", - "phpunit/phpunit": ">=3.7,<5" + "phpunit/phpunit": ">=4.6,<5" }, "require-dev": { "phpspec/phpspec": "~2.0", @@ -40,7 +40,7 @@ "": "src/" } }, - "minimum-stability": "dev", + "minimum-stability": "stable", "suggest": { "facile-it/paraunit-testcase": "Useful for Symfony2+Doctrine functional testing, providing DB isolation" } diff --git a/src/Paraunit/Bin/paraunit b/src/Paraunit/Bin/paraunit index 07ba8147..74baea3a 100755 --- a/src/Paraunit/Bin/paraunit +++ b/src/Paraunit/Bin/paraunit @@ -14,15 +14,17 @@ if (!ini_get('date.timezone') && !date_default_timezone_get()) { date_default_timezone_set('UTC'); } -use Symfony\Component\Console\Application; use Paraunit\Command\ParallelCommand; +use Symfony\Component\Console\Application; require_once __DIR__ . '/../../../Container.php'; -$command = new ParallelCommand( - $container->get('facile.cbr.parallel_test_bundle.filter.filter'), - $container->get('facile.cbr.parallel_test_bundle.runner.runner') -); +/** @var \Paraunit\Filter\Filter $filter */ +$filter = $container->get('paraunit.filter.filter'); +/** @var \Paraunit\Runner\Runner $runner */ +$runner = $container->get('paraunit.runner.runner'); + +$command = new ParallelCommand($filter, $runner); // HOTFIX -- needed to fool the Symfony's WebTestCase $_SERVER['argv'][0] = 'phpunit'; diff --git a/src/Paraunit/Resources/config/services.yml b/src/Paraunit/Resources/config/services.yml index 5583f4cc..f40c5912 100644 --- a/src/Paraunit/Resources/config/services.yml +++ b/src/Paraunit/Resources/config/services.yml @@ -5,68 +5,68 @@ parameters: services: - facile.cbr.parallel_test_bundle.filter.filter: + paraunit.filter.filter: class: Paraunit\Filter\Filter arguments: - @paraunit.proxy.phpunit_util_xml_proxy - @phpunit.file_iterator_facade - facile.cbr.parallel_test_bundle.runner.retry_manager: + paraunit.runner.retry_manager: class: Paraunit\Runner\RetryManager arguments: - %paraunit.max_retry_count% - facile.cbr.parallel_test_bundle.runner.runner: + paraunit.runner.runner: class: Paraunit\Runner\Runner scope: prototype arguments: - - @facile.cbr.parallel_test_bundle.runner.retry_manager - - @facile.cbr.parallel_test_bundle.parser.process_output_parser - - @facile.cbr.parallel_test_bundle.printer.process_printer - - @facile.cbr.parallel_test_bundle.printer.final_printer + - @paraunit.runner.retry_manager + - @paraunit.parser.process_output_parser + - @paraunit.printer.process_printer + - @paraunit.printer.final_printer - %paraunit.default_max_process% - @event_dispatcher - facile.cbr.parallel_test_bundle.printer.shark_printer: + paraunit.printer.shark_printer: class: Paraunit\Printer\SharkPrinter tags: - { name: paraunit.event_listener, event: engine_event.before_start, method: onEngineStart } - facile.cbr.parallel_test_bundle.printer.process_printer: + paraunit.printer.process_printer: class: Paraunit\Printer\ProcessPrinter - facile.cbr.parallel_test_bundle.printer.final_printer: + paraunit.printer.final_printer: class: Paraunit\Printer\FinalPrinter scope: prototype ## OUTPUT PARSERS ## - facile.cbr.parallel_test_bundle.parser.process_output_parser: + paraunit.parser.process_output_parser: class: Paraunit\Parser\ProcessOutputParser calls: - - [addParser, ["@facile.cbr.parallel_test_bundle.parser.retry_parser"]] - - [addParser, ["@facile.cbr.parallel_test_bundle.parser.segmentation_fault_parser"]] - - [addParser, ["@facile.cbr.parallel_test_bundle.parser.fatal_error_parser"]] - - [addParser, ["@facile.cbr.parallel_test_bundle.parser.error_parser"]] - - [addParser, ["@facile.cbr.parallel_test_bundle.parser.failure_parser"]] - - [addParser, ["@facile.cbr.parallel_test_bundle.parser.test_result_parser"]] - - facile.cbr.parallel_test_bundle.parser.error_parser: + - [addParser, ["@paraunit.parser.retry_parser"]] + - [addParser, ["@paraunit.parser.segmentation_fault_parser"]] + - [addParser, ["@paraunit.parser.fatal_error_parser"]] + - [addParser, ["@paraunit.parser.error_parser"]] + - [addParser, ["@paraunit.parser.failure_parser"]] + - [addParser, ["@paraunit.parser.test_result_parser"]] + + paraunit.parser.error_parser: class: Paraunit\Parser\ErrorParser - facile.cbr.parallel_test_bundle.parser.failure_parser: + paraunit.parser.failure_parser: class: Paraunit\Parser\FailureParser - facile.cbr.parallel_test_bundle.parser.fatal_error_parser: + paraunit.parser.fatal_error_parser: class: Paraunit\Parser\FatalErrorParser - facile.cbr.parallel_test_bundle.parser.retry_parser: + paraunit.parser.retry_parser: class: Paraunit\Parser\RetryParser - facile.cbr.parallel_test_bundle.parser.segmentation_fault_parser: + paraunit.parser.segmentation_fault_parser: class: Paraunit\Parser\SegmentationFaultParser - facile.cbr.parallel_test_bundle.parser.test_result_parser: + paraunit.parser.test_result_parser: class: Paraunit\Parser\TestResultsParser event_dispatcher: diff --git a/src/Paraunit/Runner/Runner.php b/src/Paraunit/Runner/Runner.php index 57962ac4..d3be3cd0 100644 --- a/src/Paraunit/Runner/Runner.php +++ b/src/Paraunit/Runner/Runner.php @@ -192,9 +192,10 @@ protected function createProcess($fileName) $configurationFile = getcwd().'/'.$this->phpunitConfigFile; $command = - $this->phpunitBin. - ' -c '.$configurationFile.' '. - $fileName. + $this->phpunitBin . + ' -c '.$configurationFile . ' ' . + ' --colors=never ' . + $fileName . ' 2>&1'; return new SymfonyProcessWrapper($command); diff --git a/src/Paraunit/Tests/Functional/RunnerTest.php b/src/Paraunit/Tests/Functional/RunnerTest.php index 3c28c6e0..b4601b83 100644 --- a/src/Paraunit/Tests/Functional/RunnerTest.php +++ b/src/Paraunit/Tests/Functional/RunnerTest.php @@ -29,7 +29,7 @@ public function testMaxRetryEntityManagerIsClosed() $outputInterface = new ConsoleOutputStub(); /** @var Runner $runner */ - $runner = $this->container->get('facile.cbr.parallel_test_bundle.runner.runner'); + $runner = $this->container->get('paraunit.runner.runner'); $fileArray = array( 'src/Paraunit/Tests/Stub/EntityManagerClosedTestStub.php', @@ -50,7 +50,7 @@ public function testMaxRetryDeadlock() { $outputInterface = new ConsoleOutputStub(); - $runner = $this->container->get('facile.cbr.parallel_test_bundle.runner.runner'); + $runner = $this->container->get('paraunit.runner.runner'); $fileArray = array( 'src/Paraunit/Tests/Stub/DeadLockTestStub.php', @@ -75,7 +75,7 @@ public function testSegFault() $outputInterface = new ConsoleOutputStub(); - $runner = $this->container->get('facile.cbr.parallel_test_bundle.runner.runner'); + $runner = $this->container->get('paraunit.runner.runner'); $fileArray = array( 'src/Paraunit/Tests/Stub/SegFaultTestStub.php',