diff --git a/tests/Feature/AdminPlatformOrderFiltersReceiptStatusHintLinkShouldKeepBusinessContextTest.php b/tests/Feature/AdminPlatformOrderFiltersReceiptStatusHintLinkShouldKeepBusinessContextTest.php new file mode 100644 index 0000000..1947d0e --- /dev/null +++ b/tests/Feature/AdminPlatformOrderFiltersReceiptStatusHintLinkShouldKeepBusinessContextTest.php @@ -0,0 +1,47 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_receipt_status_hint_link_should_keep_business_context(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin/platform-orders?' . Arr::query([ + 'merchant_id' => 2, + 'plan_id' => 3, + 'keyword' => 'alpha', + 'receipt_status' => 'none', + 'back' => '/admin/plans', + ])); + $res->assertOk(); + + $html = (string) $res->getContent(); + preg_match('/data-role="po-receipt-status-broad-none-go-paid-no-receipt"[^>]*href="([^"]+)"/u', $html, $m); + $href = html_entity_decode($m[1] ?? ''); + $query = parse_url($href, PHP_URL_QUERY) ?: ''; + parse_str($query, $q); + + $this->assertSame('2', (string) ($q['merchant_id'] ?? '')); + $this->assertSame('3', (string) ($q['plan_id'] ?? '')); + $this->assertSame('alpha', (string) ($q['keyword'] ?? '')); + $this->assertSame('/admin/plans', (string) ($q['back'] ?? '')); + } +}