Files
saasshop/tests/Feature/PublicPlatformPlansPageTest.php

66 lines
1.9 KiB
PHP

<?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');
}
}