平台订单列表:新建订单入口默认携带 back 回到当前筛选
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Arr;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderIndexCreateLinkContainsBackTest 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_create_platform_order_link_should_carry_back_to_index_self_without_back(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
// 列表页自身带 back(模拟从其它页面跳回),生成 selfWithoutBack 时应去掉 back
|
||||
$res = $this->get('/admin/platform-orders?status=pending&back=' . urlencode('/admin/plans'));
|
||||
$res->assertOk();
|
||||
|
||||
$expectedBack = '/admin/platform-orders?' . Arr::query([
|
||||
'status' => 'pending',
|
||||
]);
|
||||
|
||||
$expectedCreateUrl = '/admin/platform-orders/create?' . Arr::query([
|
||||
'back' => $expectedBack,
|
||||
]);
|
||||
|
||||
$res->assertSee($expectedCreateUrl, false);
|
||||
$res->assertDontSee('back%3D', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user