Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
Testing Database using laravel dusk

I am testing my laravel application using laravel dusk but the problem is that I am unable to use assertDatabaseHasfunction. 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

enter image description here

Here is my code:

$this->assertDatabaseHas('teams', [
    'name' => $data['team_name'],
]);
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!