douguyi3903
2016-07-17 14:48 阅读 238
已采纳

vendor / bin / phpunit不适用于Lumen

I'm new to Lumen (and Laravel). I've created a project with Composer and now I'm trying to get PHPUnit to work.

I'm following a book, where it should be possible to run a default passing test by typing vendor/bin/phpunit in the terminal, but it gives the error:

'vendor' is not recognized as an internal or external command, operable program or batch file

I've checked that the phpunit file is actually there and that phpunit is added as dependency in my composer.json file. I've also tried ./vendor/bin/phpunit and vendor/bin/phpunit/phpunit, but with the same result.

I've searched Google to find a solution, but everyone else seem to have issues when running phpunit (wihout vendor/bin) and the solution is to use the full path vendor/bin/phpunit, but since I'm already doing that, it does not fix my problem.

I'm using PHPStorm on a Windows machine and running the PHP server via PHPStorm. I've not modified the default Lumen project.

Any help is greatly appreciated!

UPDATE:

Trying php vendor/bin/phpunit gives the following error:

You need to set up the project dependencies using the following commands:
wget http://getcomposer.org/composer.phar
php composer.phar install

I'm not sure what that means, since I've already installed Composer. I used Composer to create the project and I haven't changed the dependencies from the default.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • 已采纳
    dongzaobei0942 dongzaobei0942 2016-07-17 19:17

    It turned out that some symlinks and permissions were not installed properly in the default project. I tried deleting the entire vendor/ directory and run composer install.

    Now I can run phpunit with the command vendor\bin\phpunit (because I'm running on Windows - thanks Nizarii)

    点赞 评论 复制链接分享
  • dongzhenbi8919 dongzhenbi8919 2016-07-17 15:49

    try this:

    php vendor/bin/phpunit
    
    点赞 评论 复制链接分享
  • duanche8554 duanche8554 2016-07-17 15:51

    I had the same problem, for Windows it's vendor\bin\phpunit ;)

    点赞 评论 复制链接分享

相关推荐