Reputation: 5644
I am testing my laravel application using laravel dusk but the problem is that I am unable to use assertDatabaseHas
function. When I run php artisan dusk
command I got this error:
PHP Fatal error: Class 'PHPUnit_Framework_Constraint' not found in
vendor\laravel\framework\src\Illuminate\Foundation\Testing\Constraints\HasIn
Database.php on line 8
Here is my code:
$this->assertDatabaseHas('teams', [
'name' => $data['team_name'],
]);
Upvotes: 1
Views: 892
Reputation: 17166
Please check your version of phpunit:
phpunit --version
If you are are running v6 you might have trouble because it expects a namespaced class. In that case you either have to switch to an older version of phpunit, e.g. locally installed for your project and then run like this:
php vendor/bin/phpunit --version
or you might have to update your Laravel-project, which is probably more work as you might have to change parts of your code.
Upvotes: 1