- 添加 Dockerfile 与多套 docker-compose 配置(开发/生产环境) - 集成 Laravel Octane (Swoole) 提升性能 - 新增健康检查、监控脚本及部署文档 - 新增 Docker 镜像离线导入包(MySQL/Redis/Meilisearch) - 优化文档转换、预览服务及队列任务 - 添加 CreateAdminUser 命令与路由健康检查接口 - 新增 Swoole 队列兼容性测试套件 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
62 lines
2.0 KiB
PHP
62 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Tests\TestCase;
|
|
|
|
class OctaneInstallationTest extends TestCase
|
|
{
|
|
/**
|
|
* 测试 Octane 配置是否正确加载
|
|
*/
|
|
public function test_octane_configuration_is_loaded_correctly(): void
|
|
{
|
|
// 验证 Octane 服务器配置为 swoole
|
|
$this->assertEquals('swoole', config('octane.server'));
|
|
|
|
// 验证配置文件包含正确的默认值
|
|
$this->assertIsArray(config('octane.listeners'));
|
|
$this->assertIsArray(config('octane.warm'));
|
|
$this->assertIsArray(config('octane.tables'));
|
|
$this->assertIsArray(config('octane.cache'));
|
|
$this->assertIsArray(config('octane.watch'));
|
|
}
|
|
|
|
/**
|
|
* 测试 Octane 命令是否可用
|
|
*/
|
|
public function test_octane_commands_are_available(): void
|
|
{
|
|
// 测试 octane:status 命令存在
|
|
$this->artisan('octane:status')
|
|
->assertExitCode(1); // 服务器未运行时返回 1
|
|
}
|
|
|
|
/**
|
|
* 测试 Laravel Octane 包是否正确安装
|
|
*/
|
|
public function test_octane_package_is_installed(): void
|
|
{
|
|
// 检查配置文件是否存在
|
|
$this->assertFileExists(config_path('octane.php'));
|
|
|
|
// 检查 Octane 相关类是否可用
|
|
$this->assertTrue(class_exists(\Laravel\Octane\Octane::class));
|
|
$this->assertTrue(class_exists(\Laravel\Octane\OctaneServiceProvider::class));
|
|
}
|
|
|
|
/**
|
|
* 测试 Composer 脚本是否包含 Octane 支持
|
|
*/
|
|
public function test_composer_scripts_include_octane_support(): void
|
|
{
|
|
$composerJson = json_decode(file_get_contents(base_path('composer.json')), true);
|
|
|
|
// 验证 dev-octane 脚本存在
|
|
$this->assertArrayHasKey('dev-octane', $composerJson['scripts']);
|
|
|
|
// 验证脚本包含 octane:start 命令
|
|
$devOctaneScript = implode(' ', $composerJson['scripts']['dev-octane']);
|
|
$this->assertStringContainsString('octane:start', $devOctaneScript);
|
|
}
|
|
} |