Files
saasshop/tests/Feature/AdminSiteSubscriptionShowSetStatusFormTest.php

51 lines
1.4 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\Merchant;
use App\Models\SiteSubscription;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminSiteSubscriptionShowSetStatusFormTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_show_page_should_render_set_status_form(): void
{
$this->loginAsPlatformAdmin();
$merchant = Merchant::query()->firstOrFail();
$sub = SiteSubscription::query()->create([
'merchant_id' => $merchant->id,
'status' => 'pending',
'source' => 'manual',
'subscription_no' => 'SUB_SHOW_SET_STATUS_0001',
'plan_name' => '测试套餐',
'billing_cycle' => 'monthly',
'period_months' => 1,
'amount' => 10,
'starts_at' => now()->subDay(),
'ends_at' => now()->addDays(29),
]);
$res = $this->get('/admin/site-subscriptions/' . $sub->id);
$res->assertOk();
$res->assertSee('action="/admin/site-subscriptions/' . $sub->id . '/set-status"', false);
$res->assertSee('name="status"', false);
$res->assertSee('option value="activated"', false);
}
}