feat(platform): 新增对外平台入口 /platform(首页+套餐展示)

This commit is contained in:
萝卜
2026-03-14 02:20:28 +00:00
parent 9fc289d739
commit 8c373b52dc
5 changed files with 207 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
<?php
namespace Tests\Feature;
use App\Models\Plan;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class PublicPlatformPlansPageTest extends TestCase
{
use RefreshDatabase;
public function test_public_platform_plans_page_should_only_show_active_and_published_plans(): void
{
Plan::query()->create([
'code' => 'pub_plan_active_published',
'name' => '对外展示套餐-启用已发布',
'billing_cycle' => 'monthly',
'price' => 99,
'list_price' => 129,
'status' => 'active',
'sort' => 10,
'description' => 'public ok',
'published_at' => now(),
]);
Plan::query()->create([
'code' => 'pub_plan_active_unpublished',
'name' => '不应展示-启用未发布',
'billing_cycle' => 'monthly',
'price' => 9,
'list_price' => 9,
'status' => 'active',
'sort' => 20,
'description' => 'no',
'published_at' => null,
]);
Plan::query()->create([
'code' => 'pub_plan_inactive_published',
'name' => '不应展示-停用已发布',
'billing_cycle' => 'monthly',
'price' => 199,
'list_price' => 199,
'status' => 'inactive',
'sort' => 30,
'description' => 'no',
'published_at' => now(),
]);
$res = $this->get('/platform/plans');
$res->assertOk();
$res->assertSee('对外展示套餐-启用已发布');
$res->assertDontSee('不应展示-启用未发布');
$res->assertDontSee('不应展示-停用已发布');
}
public function test_public_platform_index_page_should_be_accessible(): void
{
$this->get('/platform')
->assertOk()
->assertSee('SaaSShop');
}
}