PHPUnit - 'No tests executed' when using configuration file

后端 未结 22 695
故里飘歌
故里飘歌 2021-01-31 00:47

The Problem

To improve my quality of code, I\'ve decided to try to learn how to test my code using Unit Testing instead of my mediocre-at-best testing solutions.

相关标签:
22条回答
  • 2021-01-31 01:45

    On windows use the following command on terminal

    .\vendor\bin\phpunit
    

    that's if the command

    phpunit
    

    returns "No tests executed!"

    while on Mac

    ./vendor/bin/phpunit
    

    Hope it helps.

    0 讨论(0)
  • 2021-01-31 01:45

    Have you added a test suite to you phpunit.xml file?

    <phpunit>
        <testsuite name="app1" >
            <directory>./</directory>
        </testsuite>
    </phpunit>
    

    You can add multiple directories in there.

    0 讨论(0)
  • 2021-01-31 01:45

    If you're using @dataprovider make sure the visibility of its method is public that was my problem

    0 讨论(0)
  • 2021-01-31 01:48

    A little bit on the side maybe, but if you are (like me) using Laravel in Vagrant, make sure you are running phpunit inside of the vagrant box and not on the "windows side". :)

    0 讨论(0)
提交回复
热议问题