main: 用户管理和会话功能初始实现
- 添加用户管理功能的测试,包括创建、更新、停用、激活用户及用户登录 JWT 测试 - 提供用户管理相关的请求验证类与控制器 - 引入 CORS 配置信息,支持跨域请求 - 添加数据库播种器以便创建根用户 - 配置 API 默认使用 JWT 认证 - 添加聊天会话和消息的模型、迁移文件及关联功能
This commit is contained in:
21
tests/Feature/CorsTest.php
Normal file
21
tests/Feature/CorsTest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CorsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_allows_configured_origin(): void
|
||||
{
|
||||
$origin = 'http://localhost:5173';
|
||||
|
||||
$response = $this->withHeaders(['Origin' => $origin])->get('/api/health');
|
||||
|
||||
$response->assertOk();
|
||||
$this->assertEquals($origin, $response->headers->get('Access-Control-Allow-Origin'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user