phpunit fails on laragon on windows 10


  • | 195 points

    Hi i am developing project with laragon on windows 10 , i have installed phpunit 6.2 via composer. when i run phpunit command to run test in laravel project the following error occured

    Warning: is_dir() expects parameter 1 to be a valid path, object given in C:\Users\ddw14\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\Runner\BaseTestRunner.php on line 56

    Recoverable fatal error: Object of class PHPUnit\Framework\TestSuite could not be converted to string in C:\Users\ddw14\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\Runner\StandardTestSuiteLoader.php on line 32 PHPUnit\Framework\TestSuite could not be converted

    what could be the problem ?


  • administrators
    | 93419 points

    @ddw147 : What is your PHP's version? You can try to switch to another PHP version (https://forum.laragon.org/topic/166/tutorial-how-to-add-another-php-version) or double check your code.


  • | 195 points

    php 7.1.6 which was default version comes with laragon 3.1


  • | 195 points

    i tried without laragon same problem occurs , must be phpunit issue


  • | 499 points

    I think you have not configured your unit testing correctly. I found this great guide on Laravel unit testing that explains the two methods of doing it. You can either do it using PHPUnit or Laravel test helpers. Using test helpers is the easiest and simplest of way of unit testing your code in laravel.


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.