补强回执筛选说明链接回跳护栏
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminPlatformOrderFiltersReceiptStatusHintLinkShouldKeepBackTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
protected function loginAsPlatformAdmin(): void
|
||||||
|
{
|
||||||
|
$this->seed();
|
||||||
|
|
||||||
|
$this->post('/admin/login', [
|
||||||
|
'email' => 'platform.admin@demo.local',
|
||||||
|
'password' => 'Platform@123456',
|
||||||
|
])->assertRedirect('/admin');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_receipt_status_hint_link_should_keep_back_query(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
$res = $this->get('/admin/platform-orders?' . Arr::query([
|
||||||
|
'merchant_id' => 2,
|
||||||
|
'plan_id' => 3,
|
||||||
|
'keyword' => 'alpha',
|
||||||
|
'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('/admin/plans', (string) ($q['back'] ?? ''));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user