Posted 7 months ago by PxlFxr

Hi, guys. I found similar question https://laracasts.com/discuss/channels/testing/using-assertdatabasehas-with-laravel-dusk

But that seems not working for me.

There my code

use DatabaseMigrations;

  public function testRegister()

        $user = factory(\App\User::class)->make();

        $this->browse(function (Browser $browser) use ($user) {

            $pswd = str_random(10);

                    ->resize(1920, 1080)
                    ->type('name', $user->name)
                    ->type('email', $user->email)
                    ->type('password', $pswd)
                    ->type('password_confirmation', $pswd)
                    ->assertSeeIn('.personal__link .label', 'ЛК');

        $this->assertDatabaseHas('user', ['email'=>$user->email]);

After this executed, i see this

Caused by
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'craft_test.user' doesn't exist

How can i make assertDatabaseHas? Seems to be, migration rollback in test data base is done after $browse

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.