Acceptable Unit Test?

Published 5 months ago by andremac96

Is this an acceptable test? I have a user model with the following fields. Name, Email, Password and UserType. I'm testing the register page. This is the testing code

public function testExample()
  {
    $this->visit('/register') 
    ->type('Andre MacNamara', 'name') 
    ->type('[email protected]', 'email') 
    ->type('Landlord', 'userType') 
    ->type('password', 'password') 
    ->press('Register') 
    ->seePageIs('/register'); }

The form has all the fields above. This is the ouput from the unit test.

Image https://i.redd.it/g4g9ehvvs8x01.png

lostdreamer_nl

Almost there.....

You could be redirected back to /register with an error, or you could be on the other end of the registration with a thank you message (you're not checking for anything but the address and the formFields should exist).

I would check if the User has been inserted into the DB at this point.

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