Skip to content

Commit

Permalink
Update master to output generated at 93bbefc
Browse files Browse the repository at this point in the history
  • Loading branch information
abenevaut committed Jul 15, 2022
1 parent 402d435 commit 02b95a7
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/.vscode
/.vagrant
.phpunit.result.cache
phpunit.xml.test
coverage
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

Tool to slice PHPUnit tests files to tests suites.

- [Real use case with circleci.com](https://medium.com/@abenevaut/paralize-circleci-php-pipelines-61a0b8c21ac2)

## Install

- [Available on Packagist.org - abenevaut/phpunit-slicer](https://packagist.org/packages/abenevaut/phpunit-slicer)

### In PHP project
```shell
composer require --dev abenevaut/phpunit-slicer
Expand Down
2 changes: 2 additions & 0 deletions app/Commands/SliceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public function handle()
)
->saveTo($validator->validate()['phpunit-configuration-destination']);

$this->info("PHPUnit.xml sliced at {$validator->validate()['phpunit-configuration-destination']}");

return self::SUCCESS;
}
}
Binary file modified builds/phpunit-slicer
Binary file not shown.
3 changes: 0 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
Expand Down
22 changes: 21 additions & 1 deletion tests/Feature/SliceCommandTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?php

it('slice phpunit tests files', function () {
use Symfony\Component\Console\Exception\RuntimeException;

it('slice without argument', function () {
$this->artisan('slice');
})->throws(RuntimeException::class);

it('slice with wrong arguments', function () {
$this
->artisan('slice', [
'number-tests-suites' => 0,
Expand All @@ -13,3 +19,17 @@
->expectsOutput('The phpunit-configuration must be a valid file path.')
->expectsOutput('The tests-directory must be a valid directory path.');
});

it('slice', function () {
$destination = base_path('phpunit.xml.test');

$this
->artisan('slice', [
'number-tests-suites' => 4,
'phpunit-configuration' => base_path('phpunit.xml.dist'),
'phpunit-configuration-destination' => $destination,
'tests-directory' => base_path('tests')
])
->assertExitCode(0)
->expectsOutput("PHPUnit.xml sliced at {$destination}");
});
5 changes: 0 additions & 5 deletions tests/Unit/ExampleTest.php

This file was deleted.

0 comments on commit 02b95a7

Please sign in to comment.