Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ajvanho's avatar
Level 14

Test class with php artisan test Class

I try

php artisan test --filter FooxTest

error:Fatal error: because the name is already in use...

0 likes
4 replies
automica's avatar

have you got 2 tests called 'FooxTest' ?

automica's avatar

run composer dump-autoload which might resolve it.

I've tried both

php artisan test --filter test_method_name

and

php artisan test --filter ClassName

and both work for me.

You can also run tests via their directories

php artisan test tests/Unit/SomeDirectory

1 like

Please or to participate in this conversation.