refactor(test): 提取订阅详情页测试数据构造方法
This commit is contained in:
@@ -13,20 +13,8 @@ class AdminSiteSubscriptionShowTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function loginAsPlatformAdmin(): void
|
||||
protected function seedSubscriptionForShow(): array
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
$this->post('/admin/login', [
|
||||
'email' => 'platform.admin@demo.local',
|
||||
'password' => 'Platform@123456',
|
||||
])->assertRedirect('/admin');
|
||||
}
|
||||
|
||||
public function test_platform_admin_can_open_site_subscription_show_page(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'sub_show_test',
|
||||
@@ -103,6 +91,25 @@ class AdminSiteSubscriptionShowTest extends TestCase
|
||||
],
|
||||
]);
|
||||
|
||||
return [$merchant, $plan, $sub];
|
||||
}
|
||||
|
||||
protected function loginAsPlatformAdmin(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
$this->post('/admin/login', [
|
||||
'email' => 'platform.admin@demo.local',
|
||||
'password' => 'Platform@123456',
|
||||
])->assertRedirect('/admin');
|
||||
}
|
||||
|
||||
public function test_platform_admin_can_open_site_subscription_show_page(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
[$merchant, $plan, $sub] = $this->seedSubscriptionForShow();
|
||||
|
||||
$this->get('/admin/site-subscriptions/' . $sub->id)
|
||||
->assertOk()
|
||||
->assertSee('订阅详情')
|
||||
|
||||
Reference in New Issue
Block a user