PASS Tests\Feature\AuthUserTest
✓ an auth user can visit user profile page
PASS Tests\Feature\UserTest
✓ a guest can access welcome page
✓ a guest can access login page
✓ a guest can access register page
If you run php artisan test --help or php artisan help test you will see that there is no option to filter. So you either use it as is, or you go with the vendor/bin/phpunit --filter/vendor/bin/phpunit path/to/the/file.php option.
@bugsysha Not exactly. @sergiu17’s suggestion was to use Laravel’s test Artisan command, which wraps PHPUnit but not exactly. I’ve had issues with it in the past trying to pass certain PHPUnit flags.
But yes, phpunit will let you run a single test class by specifying the name of the file as an argument. If you want the names of the test cases being ran to be output, then you can specify the --testdox flag:
@bugsysha I have selected @martinbean 's answer as the BEST ANSWER because it let me run a single test class + outputs the test cases of that single class(which i was expecting as default)
PHP Warning: Declaration of PHPUnit\Util\TestDox\CliTestDoxPrinter::printHeader(): void should be compatible with PHPUnit\TextUI\DefaultResultPrinter::printHeader(PHPUnit\Framework\TestResult $result): void in /usr/share/php/PHPUnit/Util/TestDox/CliTestDoxPrinter.php on line 118
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.
User (Tests\Feature\User)
✔ A guest can access welcome page
✔ A guest can access login page
✔ A guest can access register page
Call to undefined method SebastianBergmann\Timer\Timer::resourceUsage()