test(back): 平台订单创建表单 back 链接不应 escape &(护栏)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderFormBackLinkNotEscapedTest 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_form_back_link_should_not_escape_ampersand(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$back = '/admin/site-subscriptions?status=activated&keyword=test';
|
||||
|
||||
$res = $this->get('/admin/platform-orders/create?back=' . urlencode($back));
|
||||
$res->assertOk();
|
||||
|
||||
$res->assertSee('返回(保留上下文)');
|
||||
$res->assertSee('href="' . $back . '"', false);
|
||||
$res->assertDontSee('href="' . str_replace('&', '&', $back) . '"', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user