tenant = Tenant::factory()->create(); }); test('косяк 05: вход с неподтверждённой почтой зовёт подтвердить, а не «заблокирован»', function () { User::factory()->create([ 'tenant_id' => $this->tenant->id, 'email' => 'unconfirmed@example.ru', 'password_hash' => Hash::make('right-pass-123'), 'is_active' => false, 'email_verified_at' => null, ]); $response = $this->postJson('/api/auth/login', [ 'email' => 'unconfirmed@example.ru', 'password' => 'right-pass-123', ]); $response->assertStatus(422); $response->assertJsonPath('email_not_confirmed', true); expect($response->json('errors.email.0'))->toContain('одтвердите почту') ->and($response->json('errors.email.0'))->not->toContain('аблокирован'); }); test('косяк 05: подтверждённая почта но is_active=false остаётся «Аккаунт заблокирован»', function () { User::factory()->create([ 'tenant_id' => $this->tenant->id, 'email' => 'really-blocked@example.ru', 'password_hash' => Hash::make('right-pass-123'), 'is_active' => false, 'email_verified_at' => now(), ]); $response = $this->postJson('/api/auth/login', [ 'email' => 'really-blocked@example.ru', 'password' => 'right-pass-123', ]); $response->assertStatus(422); $response->assertJsonPath('errors.email.0', 'Аккаунт заблокирован.'); expect($response->json('email_not_confirmed'))->toBeNull(); });