feat(users): enforce active email uniqueness per role
This commit is contained in:
@@ -60,6 +60,17 @@ class AdministratorControllerTest extends TestCase
|
||||
return ['nombre_apellido' => 'Ada Lovelace', 'dni' => '12345678', 'email' => 'ada@example.test'];
|
||||
}
|
||||
|
||||
public function test_email_can_be_shared_with_customers_and_scanners(): void
|
||||
{
|
||||
Sanctum::actingAs($this->admin);
|
||||
foreach (['user', 'scanner'] as $role) {
|
||||
User::factory()->create(['email' => 'ada@example.test', 'rol_codigo' => $role]);
|
||||
}
|
||||
$response = $this->postJson(self::URL, $this->payload())->assertCreated();
|
||||
$this->putJson(self::URL.'/'.$response->json('data.id'), $this->payload())->assertOk();
|
||||
$this->postJson(self::URL, $this->payload())->assertUnprocessable()->assertJsonValidationErrors('email');
|
||||
}
|
||||
|
||||
public function test_crud_and_password_setup_and_token_revocation(): void
|
||||
{
|
||||
Sanctum::actingAs($this->admin);
|
||||
|
||||
Reference in New Issue
Block a user