36 lines
987 B
PHP
36 lines
987 B
PHP
<?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);
|
|
}
|
|
}
|