You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,14 +9,14 @@
9
9
10
10
**FRT automatically executes the associated PHPUnit test for a changed source code file.**
11
11
12
-
It takes a different approach to [spatie/phpunit-watcher](https://packagist.org/packages/spatie/phpunit-watcher), a mature und well-developed testing tool. Its goal is to automatically re-execute the entire PHPUnit test suite when source code files are changed. The `phpunit-watcher watch` command starts an own watch process which executes the *full* test suite once a file has changed. However, the executed tests can, however, be restricted to *specific* tests using the `--filter` option. This means that regardless of which file is changed or saved, only the specified unit tests are executed.
12
+
**Comparison with spatie/phpunit-watcher:**[spatie/phpunit-watcher](https://packagist.org/packages/spatie/phpunit-watcher)re-executes the *entire* PHPUnit test suite once a source code file has changed. The executed tests can be restricted to *specific* tests using the `--filter` option. This means that regardless of which file is changed or saved, only the specified unit tests are executed.
Compared to this package, *tomkyle/find-run-test* takes a different approach: After saving a file, only the PHPUnit test associated with the modified file is executed.
19
+
**tomkyle/find-run-test takes a different approach:** After saving a file, only the PHPUnit test associated with the modified file is executed.
@@ -32,7 +32,7 @@ Compared to this package, *tomkyle/find-run-test* takes a different approach: Af
32
32
Install FRT with Composer:
33
33
34
34
```bash
35
-
$ composer require tomkyle/find-run-test
35
+
$ composer require --dev tomkyle/find-run-test
36
36
```
37
37
38
38
## How it works
@@ -44,11 +44,14 @@ The `vendor/bin/frt` executable expects the PHP file of which the source code ha
44
44
$ vendor/bin/frt src/MyClass.php
45
45
```
46
46
47
-
2. FRT will look for any PHPUnit file inside the project’s `tests` directory.
47
+
2. FRT will look for matching PHPUnit tests inside the project’s `tests` directory.
48
48
49
-
3. If there is a test file `MyClassTest.php`, FRT will execute it using PHPUnit’s `--filter` option.
49
+
3. If there is a test file `MyClassTest.php`, FRT will hand it over to PHPUnit, like so:
50
+
```bash
51
+
$ vendor/bin/phpunit --filter=MyClassTest.php
52
+
```
50
53
51
-
## Usage
54
+
## Automation
52
55
53
56
Our goal is to automate testing as much as possible, and so do we with running unit tests. In the Node-based app developing world, [Chokidar](https://www.npmjs.com/package/chokidar) is one of the go-to file watching libraries, most often used for frontend building with *webpack, gulp, workbox,* and such. We will utilize it for FRT.
0 commit comments