Home » Php » Run one file or map in phpunit

Run one file or map in phpunit

Posted by: admin November 29, 2017 Leave a comment

Questions:

I’m using laravel and I’ve written some test files. But how can I exec only one file? When I do for example: phpunit tests/resulttesting/school/deleteSchoolForRealTest It throws an error:

Cannot open file
“tests/resulttesting/school/deleteSchoolForRealTest.php”.

When I run phpunit it runs all my tests. And how can I exec only one folder? I’m on a mac.

Answers:

You are doing everything correctly. My correct way was:

phpunit tests/EWalletTest

I had same errors when I forget to start from “tests” folder

phpunit EWalletTest

I got

Cannot open file “EWalletTest.php”.

Questions:
Answers:

Use filter option

phpunit --filter=EWalletTest