https://github.com/stekel/autotest
Automatically run unit tests when a file is saved by utilizing entr
https://github.com/stekel/autotest
entr laravel phpunit
Last synced: 3 months ago
JSON representation
Automatically run unit tests when a file is saved by utilizing entr
- Host: GitHub
- URL: https://github.com/stekel/autotest
- Owner: stekel
- License: mit
- Created: 2017-10-03T22:05:21.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-11-06T16:13:20.000Z (12 months ago)
- Last Synced: 2025-06-08T20:38:22.435Z (5 months ago)
- Topics: entr, laravel, phpunit
- Language: PHP
- Size: 192 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AutoTest
Automatically run unit tests when a project file is saved.
## Requirements
- PHP >= 7
- PHPUnit >= 6 or Pest > 2
- entr >= 3.4
## Installation
- Install entr
```bash
sudo apt-get install entr
```
- Require it with Composer:
```bash
composer global require stekel/autotest
```
The `autotest` executable should now be located in the `~/.composer/vendor/bin/` directory.
- Add this directory to your PATH in your ~/.bash_profile or ~/.bashrc
```bash
export PATH=~/.composer/vendor/bin:$PATH
```
## Usage
### Laravel
Run the following command from the root of a Laravel application
```bash
php artisan stekel:autotest
```
Note: this will use the local phpunit `./vendor/bin/phpunit`
### Generic
Run the following command from the root of a composer project with phpunit
```bash
autotest
```
Note: this will use the global phpunit `~/.composer/vendor/bin/phpunit`
Your tests should run one time, after that `autotest` will run your tests every time a file within your project is saved. No more switching between your editor and a terminal.
## Arguments & Flags
`-f` Filter: passed to phpunit as the --filter parameter
`-g` Group: passed to phpunit as the --group parameter
`-d` Directory: passed to phpunit as the directory argument, prepends './tests/'
`--coverage` Code Coverage: pending phpunit is configured to output code coverage reports, removes the `--no-coverage` flag
`--localphpunit` Force Local phpunit: forces the use of `./vendor/bin/phpunit` as the phpunit location
`--globalphpunit` Force Global phpunit: forces the use of `~/.composer/vendor/bin/phpunit` as the phpunit location