I am using Pest library to write tests in laravel. I created the my-laravel-application/tests/Integration
directory in laravel
and defined a new test suite in phpunit.xml
<testsuite name="Integration">
<directory suffix=".test.php">./tests/Integration</directory>
</testsuite>
So that laravel acknowledges the test files in Integration directory and I could write my integration tests in a separate directory with a proper name(Integration directory), And I put my test files in the my-laravel-application/tests/Integration
directory and I got the following error while running php artisan test
:
InvalidArgumentException - Unknown format "name"
vendor/fakerphp/faker/src/Faker/Generator.php:657
which indicates that the $this->faker->name()
line of code in my UserFactory
(I am using UserFactory class in my tests) has something wrong with, it says that name() method does not exist on $this->faker. But my tests used to work fine, before moving them to my-laravel-application/tests/Integration
directory. What is the real problem and how can I fix this?
This thread saved me lots of time.
I made sure an using right test case in the entire test dir...