Laravel 4 testing; 'phpunit' is not recognized?

后端 未结 5 1197
旧时难觅i
旧时难觅i 2021-02-03 22:46

http://four.laravel.com/docs/testing Says \"After installing a new Laravel application, simply run phpunit on the command line to run your tests.\"

ph

5条回答
  •  说谎
    说谎 (楼主)
    2021-02-03 23:04

    Install with composer

    An easy way to get up and running with PHPUnit (without needing to install Pear and clutter up every system you want to use this on) is to include it in your composer.json file, like

    "phpunit/phpunit": "4.0.*",
    

    Then after doing a composer update you'll be able to run PHPUnit from command line like this:

    vendor/bin/phpunit 
    

    Since phpunit will be installed into the vendor/bin folder.

    This will install PHPUnit to this project only, not your whole system. So when you want it gone, you simply remove the line from your composer.json file, run composer update, and poof, not a trace.

    Installing for development environments only

    If you only want to use this during development, add the composer line inside the "require-dev" section. That way it will only be installed when you opt to install dev dependancies via:

    php composer.phar install --dev
    

    or

    php composer.phar update
    

提交回复
热议问题