04a2034975
- storefront 全站改为极简黑白配色:直角、细线分隔、卡片 hover 浅底、深色模式(跟随系统+手动切换) - 抽出 storefront/partials/card 复用卡片 - 一并提交此前暂存的客户端注册 API、站点设置、后台页面与测试 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
72 lines
2.1 KiB
PHP
72 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\StoreClient;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class WebAdminClientsPageTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_authenticated_admin_can_view_clients_page(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
|
|
StoreClient::query()->create([
|
|
'site_url' => 'https://demo.example.com',
|
|
'site_name' => 'Demo Blog',
|
|
'access_token' => str_repeat('a', 96),
|
|
'status' => 'online',
|
|
'user_count' => 12,
|
|
'typecho_version' => '1.3.0',
|
|
'php_version' => '8.2.16',
|
|
'plugin_version' => '1.0.0',
|
|
'registered_at' => now()->subDay(),
|
|
'last_seen_at' => now(),
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->get('/admin/clients')
|
|
->assertOk()
|
|
->assertSee('站点接入')
|
|
->assertSee('Demo Blog')
|
|
->assertSee('https://demo.example.com')
|
|
->assertSee('用户数')
|
|
->assertSee('在线');
|
|
}
|
|
|
|
public function test_clients_page_can_filter_offline_sites(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
|
|
StoreClient::query()->create([
|
|
'site_url' => 'https://online.example.com',
|
|
'site_name' => 'Online',
|
|
'access_token' => str_repeat('b', 96),
|
|
'status' => 'online',
|
|
'user_count' => 3,
|
|
'registered_at' => now()->subHours(2),
|
|
'last_seen_at' => now(),
|
|
]);
|
|
|
|
StoreClient::query()->create([
|
|
'site_url' => 'https://offline.example.com',
|
|
'site_name' => 'Offline',
|
|
'access_token' => str_repeat('c', 96),
|
|
'status' => 'online',
|
|
'user_count' => 5,
|
|
'registered_at' => now()->subHours(5),
|
|
'last_seen_at' => now()->subHour(),
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->get('/admin/clients?status=offline')
|
|
->assertOk()
|
|
->assertSee('Offline')
|
|
->assertDontSee('Online');
|
|
}
|
|
}
|