Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.

Commit 8460875

Browse files
author
joselfonseca
committed
add test for input registration validation
1 parent b7e89ac commit 8460875

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/Feature/Auth/RegisterTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,20 @@ public function test_it_register_user_with_role()
4040
return $user->id === $event->user->id;
4141
});
4242
}
43+
44+
public function test_it_validates_input_for_registration()
45+
{
46+
Event::fake([Registered::class]);
47+
$response = $this->json('POST', 'api/register', [
48+
'name' => 'Some User',
49+
'email' => '[email protected]',
50+
'password' => '123456789qq',
51+
]);
52+
$response->assertStatus(422);
53+
$this->assertDatabaseMissing('users', [
54+
'name' => 'Some User',
55+
'email' => '[email protected]',
56+
]);
57+
Event::assertNotDispatched(Registered::class);
58+
}
4359
}

0 commit comments

Comments
 (0)