Skip to content

Commit

Permalink
Resolve #8; minor refinements in services naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean85 committed Sep 1, 2015
1 parent 2c3c0d5 commit 51acbca
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
Expand Down
12 changes: 7 additions & 5 deletions src/Paraunit/Bin/paraunit
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
48 changes: 24 additions & 24 deletions src/Paraunit/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions src/Paraunit/Runner/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/Paraunit/Tests/Functional/RunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down

0 comments on commit 51acbca

Please sign in to comment.