Files
saasshop/tests/Feature/AdminDashboardBillingWorkbenchLinksCarrySafeBackTest.php

38 lines
1.1 KiB
PHP

<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminDashboardBillingWorkbenchLinksCarrySafeBackTest 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_dashboard_billing_workbench_entry_links_should_carry_safe_back_and_not_escape_ampersand(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin?back=' . urlencode('/admin/plans?status=active'));
$res->assertOk();
$res->assertSee('收费工作台');
$res->assertSee('href="/admin/platform-orders?back=%2Fadmin%2Fplans%3Fstatus%3Dactive"', false);
$res->assertSee('href="/admin/site-subscriptions?back=%2Fadmin%2Fplans%3Fstatus%3Dactive"', false);
$res->assertSee('href="/admin/plans?back=%2Fadmin%2Fplans%3Fstatus%3Dactive"', false);
$res->assertDontSee('&amp;back=', false);
}
}