diff --git a/tests/Feature/AdminSiteSubscriptionShowOrderSyncStatusFilterLinksKeepBackTest.php b/tests/Feature/AdminSiteSubscriptionShowOrderSyncStatusFilterLinksKeepBackTest.php new file mode 100644 index 0000000..abbd581 --- /dev/null +++ b/tests/Feature/AdminSiteSubscriptionShowOrderSyncStatusFilterLinksKeepBackTest.php @@ -0,0 +1,57 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_show_page_order_sync_status_filter_links_should_keep_back_and_not_escape_ampersand(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + + $sub = SiteSubscription::query()->create([ + 'merchant_id' => $merchant->id, + 'status' => 'activated', + 'source' => 'manual', + 'subscription_no' => 'SUB_SHOW_FILTER_BACK_0001', + 'plan_name' => '测试套餐', + 'billing_cycle' => 'monthly', + 'period_months' => 1, + 'amount' => 10, + 'starts_at' => now()->subDay(), + 'ends_at' => now()->addDays(29), + 'activated_at' => now()->subDay(), + ]); + + $back = '/admin/platform-orders?status=pending&keyword=abc'; + $expectedBack = urlencode($back); + + $res = $this->get('/admin/site-subscriptions/' . $sub->id . '?back=' . $expectedBack); + $res->assertOk(); + + // “全部”应保留 back + $res->assertSee('href="/admin/site-subscriptions/' . $sub->id . '?back=' . $expectedBack . '"', false); + + // “可同步”应同时带 back + order_sync_status,且 & 不应被 escape 成 & + $res->assertSee('href="/admin/site-subscriptions/' . $sub->id . '?back=' . $expectedBack . '&order_sync_status=syncable"', false); + $res->assertDontSee('back=' . $expectedBack . '&order_sync_status=syncable', false); + } +}