Running a single file or map in phpunit

I use laravel and I wrote some test files. But how can I execute only one file? When I do, for example: phpunit tests/resulttesting/school/deleteSchoolForRealTest It throws an error:

Cannot open the file "Tests / resulttesting / school / deleteSchoolForRealTest.php".

When I run phpunit, it runs all my tests. And how can I execute only one folder? I'm on a poppy.

+9
source share
2 answers

You are doing everything right.

1) The first way to add a folder . My correct way was:

 phpunit tests/EWalletTest 

I had the same errors when I forgot to start from the tests folder

 phpunit EWalletTest 

I got

Cannot open the file "EWalletTest.php".

2) A filter is another option. read an example here :

 phpunit --filter EWallet 

Runs only tests whose name matches the given regular expression pattern.

This means that you have EWalletTest and EWalletFooTest and test cases from other files with names such as' test_EWallet_with_Australian_dollar.

+16
source

Use filter option

 phpunit --filter=EWalletTest 
+11
source

All Articles