diff --git a/tests/Feature/AdminSiteSubscriptionShowTest.php b/tests/Feature/AdminSiteSubscriptionShowTest.php index 4d2e631..de7624f 100644 --- a/tests/Feature/AdminSiteSubscriptionShowTest.php +++ b/tests/Feature/AdminSiteSubscriptionShowTest.php @@ -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('订阅详情')