Skip to content

Commit

Permalink
Merge pull request #303 from cdekok/phpunit-suite
Browse files Browse the repository at this point in the history
Phpunit suite
  • Loading branch information
veewee authored Feb 24, 2017
2 parents 74b3d7d + 050c1c7 commit 7ca6d0a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/tasks/phpunit.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ parameters:
tasks:
phpunit:
config_file: ~
testsuite: ~
group: []
always_execute: false
```
Expand All @@ -21,15 +22,26 @@ If your phpunit.xml file is located at an exotic location, you can specify your
This option is set to `null` by default.
This means that `phpunit.xml` or `phpunit.xml.dist` are automatically loaded if one of them exist in the current directory.


**testsuite**

*Default: null

If you wish to only run tests from a certain Suite.
`testsuite: unit`


**group**

*Default: array()*

If you wish to only run tests from a certain Group.
`group: [fast,quick,small]`


**always_execute**

*Default: false*

Always run the whole test suite, even if no PHP files were changed.

1 change: 1 addition & 0 deletions spec/Task/PhpunitSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function it_should_have_configurable_options()
$options = $this->getConfigurableOptions();
$options->shouldBeAnInstanceOf(OptionsResolver::class);
$options->getDefinedOptions()->shouldContain('config_file');
$options->getDefinedOptions()->shouldContain('testsuite');
$options->getDefinedOptions()->shouldContain('group');
$options->getDefinedOptions()->shouldContain('always_execute');
}
Expand Down
3 changes: 3 additions & 0 deletions src/Task/Phpunit.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ public function getConfigurableOptions()
$resolver = new OptionsResolver();
$resolver->setDefaults([
'config_file' => null,
'testsuite' => null,
'group' => [],
'always_execute' => false,
]);

$resolver->addAllowedTypes('config_file', ['null', 'string']);
$resolver->addAllowedTypes('testsuite', ['null', 'string']);
$resolver->addAllowedTypes('group', ['array']);
$resolver->addAllowedTypes('always_execute', ['bool']);

Expand Down Expand Up @@ -62,6 +64,7 @@ public function run(ContextInterface $context)

$arguments = $this->processBuilder->createArgumentsForCommand('phpunit');
$arguments->addOptionalArgument('--configuration=%s', $config['config_file']);
$arguments->addOptionalArgument('--testsuite=%s', $config['testsuite']);
$arguments->addOptionalCommaSeparatedArgument('--group=%s', $config['group']);

$process = $this->processBuilder->buildProcess($arguments);
Expand Down

0 comments on commit 7ca6d0a

Please sign in to comment.