Run PHPUnit tests on change

后端 未结 10 1691
星月不相逢
星月不相逢 2021-02-07 11:34

I\'d like to run my PHPUnit tests (or at least a subset of them) whenever a file changes on disk. Very similar to what you can do with \"grunt watch\". I have a project in which

10条回答
  •  醉话见心
    2021-02-07 12:01

    I've wrote a blog post on this a while back: http://edorian.github.io/2010-03-11-running-your-unit-tests-everytime-you-save-a-file/

    The most basic command would be:

    pywatch phpunit .
    

    which would mean "monitor all files in this directory and below for changes and if one of them changes run PHPUnit".

    If you have a lot of files in there (assets etc) that can get slow so a better/faster version is:

    find -name '*.php' | xargs pywatch "./runSuite.sh"
    

    which only monitors changes to .php files

提交回复
热议问题