When trying to call the press()
method, I always get
InvalidArgumentException: Unreachable field ""
at that line.
According to the docs:
"Press" a button with the given text or name.
My method: press('Create')
and my button is <button class="btn btn-lg btn-primary" type="submit" name="submit">Create</button>
. I have also tried to use the name
with the same result.
I have also tried submitForm('Create')
which works, but then seeInDatabase('employees', ['email' => 'john@email.com'])
always fails.
Unable to find row in database table [employees] that matched attributes [{"email":"john@email.com"}].
Here is my full method
public function testExample()
{
$this->actingAs(\App\Employee::where('username', 'grant')->first())
->visit('/employees/create')
->type('john', 'username')
->type('1234', 'password')
->type('john@email.com', 'email')
->submitForm('Create')
->seeInDatabase('employees', ['email' => 'john@email.com'])
->see('Employee Directory');
}
Aucun commentaire:
Enregistrer un commentaire