D
D
Div-Man2018-12-27 20:36:05
Laravel
Div-Man, 2018-12-27 20:36:05

Why doesn't the assertDatabaseHas method work for tests?

Out of the box, the assertDatabaseHas method works, but if you use the
browser-kit-testing package, it will display a message that there is no such method, why is that?
Some of the methods from the browser-kit-testing package themselves work.
You have to switch, but this is not an option at all.

<?php

namespace Tests;


//use Laravel\BrowserKitTesting\TestCase as BaseTestCase;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication;
    
    public $baseUrl = 'http://localhost';
}

function name_is_just_long_enough_to_pass()
    {
        $this->assertDatabaseHas('users', [
            'email' => '[email protected]'
        ]);
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question