套餐列表:新建套餐入口默认携带 back 回到当前筛选
This commit is contained in:
@@ -120,7 +120,10 @@
|
|||||||
<h3>套餐列表</h3>
|
<h3>套餐列表</h3>
|
||||||
<p class="muted muted-xs">后续将从这里进入套餐详情、授权项与订阅联动。</p>
|
<p class="muted muted-xs">后续将从这里进入套餐详情、授权项与订阅联动。</p>
|
||||||
</div>
|
</div>
|
||||||
<a href="/admin/plans/create" class="btn">新建套餐</a>
|
@php
|
||||||
|
$createPlanUrl = '/admin/plans/create?' . \Illuminate\Support\Arr::query(['back' => $selfWithoutBack]);
|
||||||
|
@endphp
|
||||||
|
<a href="{!! $createPlanUrl !!}" class="btn">新建套餐</a>
|
||||||
</div>
|
</div>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
41
tests/Feature/AdminPlanIndexCreateLinkContainsBackTest.php
Normal file
41
tests/Feature/AdminPlanIndexCreateLinkContainsBackTest.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminPlanIndexCreateLinkContainsBackTest 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_plan_link_should_carry_back_to_index_self_without_back(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
$res = $this->get('/admin/plans?status=active&back=' . urlencode('/admin/platform-orders'));
|
||||||
|
$res->assertOk();
|
||||||
|
|
||||||
|
$expectedBack = '/admin/plans?' . Arr::query([
|
||||||
|
'status' => 'active',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$expectedCreateUrl = '/admin/plans/create?' . Arr::query([
|
||||||
|
'back' => $expectedBack,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$res->assertSee($expectedCreateUrl, false);
|
||||||
|
$res->assertDontSee('back%3D', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user