jeudi 16 août 2018

Laravel Dusk Edit Database

I am a beginner in using Laravel Dusk and need some help. I want to be able to change a value in the database so that I can confirm/validate the user I just registered with the code below. How will I achieve that in my tests? I want to be able to change that value in the database immediately after I assertDatabaseHas(...the user I just created...)

public function testRegisterUser()
    {
        //Register with all info filled out correctly
        $this->browse(function ($browser){
            $browser->visit('/register')
                    ->type('firstName', 'JenLogin')
                    ->type('lastName', 'Zhou')
                    ->type('email', 'testLogin@gmail.com')
                    ->type('bio', 'Hello, this user is for testing login purposes!')
                    ->type('location_zip', '11111')
                    ->type('password', '123456')
                    ->type('password_confirmation', '123456')
                    ->click('.btn-primary')
                    ->assertPathIs('/home')
                    ->click('.dropdown-toggle')
                    ->click('.dropdown-menu li:last-child');

        });

        $this->assertDatabaseHas('users', ['firstName' => 'JenLogin', 'lastName' => 'Zhou', 'email' => 'testLogin@gmail.com']);


    }

Aucun commentaire:

Enregistrer un commentaire