feat: add domain registration form and email notifications
- Create a new Blade view for domain registration (`registrant-tochuc.blade.php`) to capture organization and manager details. - Implement email templates for new domain orders for both admin (`domain-order-new.blade.php`) and customers (`domain-order-received.blade.php`). - Add CSV exports for client and domain data. - Introduce tests for customer mass assignment, password reset, login throttling, and permission gating. - Ensure service renewals use current pricing and validate ownership for virtual machines. - Validate mass assignment behavior in service model.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Api\Admin;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
class LoginThrottleTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
// Đảm bảo state rate-limit sạch, không bị ảnh hưởng bởi request từ test khác
|
||||
// chạy cùng tiến trình PHPUnit (cache 'array' không tự reset giữa các test file).
|
||||
Cache::flush();
|
||||
}
|
||||
|
||||
public function test_admin_login_is_throttled_after_5_attempts_per_minute(): void
|
||||
{
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$response = $this->postJson('/api/v1/administrator/login', [
|
||||
'email' => 'nobody@example.com',
|
||||
'password' => 'wrong-password',
|
||||
]);
|
||||
$this->assertNotSame(429, $response->status());
|
||||
}
|
||||
|
||||
$response = $this->postJson('/api/v1/administrator/login', [
|
||||
'email' => 'nobody@example.com',
|
||||
'password' => 'wrong-password',
|
||||
]);
|
||||
|
||||
$response->assertStatus(429);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user