Git Product home page Git Product logo

phpunit-watcher's Introduction

Automatically rerun PHPUnit tests when source code changes

Latest Version on Packagist Build Status SensioLabsInsight Quality Score StyleCI Total Downloads

Wouldn't it be great if your PHPUnit tests would be automatically rerun whenever you change some code? This package can do exactly that.

With the package installed you can do run this:

phpunit-watcher watch

This will run the tests and rerun them whenever a file in the src or tests directory is modified.

Want to pass some arguments to PHPUnit? No problem, just tack them on:

phpunit-watcher watch --filter=it_can_run_a_single_test

Postcardware

You're free to use this package (it's MIT-licensed), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.

We publish all received postcards on our company website.

Installation

You can install this package globally like this

composer global require spatie/phpunit-watcher

After that phpunit-watcher watch can be run in any directory on your system.

Alternatively you can install the package locally as a dev dependency in your project

composer require spatie/phpunit-watcher --dev

Locally installed you can run it with vendor/bin/phpunit-watcher watch

For performance reasons the package will create a .phpunit-watcher.cache.php inside the directory where it is run. You should add an entry for that file in your global gitignore.

Usage

All the examples assume you've installed the package globally. If you opted for the local installation prepend vendor/bin/ everywhere where phpunit-watcher is mentioned.

You can start the watcher with:

phpunit-watcher watch

This will run the tests and rerun them whenever a file in the src or tests directory is modified.

You can customize the directories being watched by creating a file named .phpunit-watcher.yml in your project directory. Here's some example content:

watch:
  directories:
    - src
    - tests
  fileMask: '*.php'

Want to pass some arguments to PHPUnit no problem, just tack them on:

phpunit-watcher watch --filter=it_can_run_a_single_test

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

About Spatie

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

License

The MIT License (MIT). Please see License File for more information.

phpunit-watcher's People

Contributors

freekmurze avatar svenluijten avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.