Download the PHP package teamntime/grumphp-phpunit-diff without Composer
On this page you can find all versions of the php package teamntime/grumphp-phpunit-diff. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download teamntime/grumphp-phpunit-diff
More information about teamntime/grumphp-phpunit-diff
Files in teamntime/grumphp-phpunit-diff
Package grumphp-phpunit-diff
Short Description A GrumPHP task that runs only the tests for the files you have changed
License MIT
Informations about the package grumphp-phpunit-diff
GrumPHP PHPUnit Diff Task
Whoa, another PHPUnit task for GrumPHP? Well kind of.
We at Team n Time run GrumPHP both on our development machines and on our CI servers. All of our PHPUnit test suites run on CI to ensure we didn't create a regression or broke something. You could opt to run your testsuites also locally but that might not always be practical. If you get over a certain amount of assertions, this could become cumbersome.
For us, the goal is to balance not wasting developer hours vs. not wasting CI runs. It's in this balancing act that we've dreamt up having tooling that runs just tests on the difference. But what does that mean? GrumPHP handily provides you with the file names of the changed files, but there is no standard that makes locating test files of PHP classes easy.
That's where this task comes in. It allows you to define the structure of your project by creating a simple PHP function that gives you the PHP class filepath and allows you to define where it's test is located. We do this with simple str_replace, but you might opt for any other strategy.
Install and using
Install by running composer:
Create a PHP file with your location function that have the following structure:
If you would like to see a more in-depth example, you can reference the default implementation
Update your grumphp.yml file:
How does it work?
There's two problems that this package solves:
- How to locate a test for a changed file/class: We've solved this by introducing a function that allows any project to customise how the relation between test <-> class is set up
- PHPUnit does not allow you to pass multiple files as arguments, only directories: We've solved this by duplicating the existing PHPUnit config and adding a Testsuite with the changed files.
All versions of grumphp-phpunit-diff with dependencies
phpro/grumphp Version ^1.3.3
symfony/dependency-injection Version ^5.4|^6.1
symfony/process Version ^5.4|^6.1
symfony/options-resolver Version ^5.4|^6.1
symfony/filesystem Version ^5.4|^6.1