diff --git a/tests/Feature/AdminPlatformOrderIndexQuickFilterPaidNoReceiptShouldPreserveContextTest.php b/tests/Feature/AdminPlatformOrderIndexQuickFilterPaidNoReceiptShouldPreserveContextTest.php new file mode 100644 index 0000000..3908b67 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexQuickFilterPaidNoReceiptShouldPreserveContextTest.php @@ -0,0 +1,56 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_quick_filter_paid_no_receipt_should_preserve_context_and_clear_toggles(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin/platform-orders?merchant_id=1' + . '&created_from=2026-03-01&created_to=2026-03-18' + . '&page=2' + . '&bmpa_failed_only=1&bmpa_error_keyword=timeout&fail_only=1' + . '&back=/admin' + ); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $this->assertMatchesRegularExpression('/]*data-role="po-quickfilter-paid-no-receipt"[^>]*href="([^"]+)"/u', $html); + preg_match('/]*data-role="po-quickfilter-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('paid', (string) ($q['payment_status'] ?? '')); + $this->assertSame('none', (string) ($q['receipt_status'] ?? '')); + + $this->assertSame('1', (string) ($q['merchant_id'] ?? '')); + $this->assertSame('2026-03-01', (string) ($q['created_from'] ?? '')); + $this->assertSame('2026-03-18', (string) ($q['created_to'] ?? '')); + $this->assertSame('/admin', (string) ($q['back'] ?? '')); + + $this->assertArrayNotHasKey('page', $q); + $this->assertArrayNotHasKey('bmpa_failed_only', $q); + $this->assertArrayNotHasKey('bmpa_error_keyword', $q); + $this->assertArrayNotHasKey('fail_only', $q); + } +}