Files
saasshop/tests/Feature/AdminPlatformOrderIndexRowWarnLinkStyleScopedTest.php

37 lines
1.1 KiB
PHP

<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderIndexRowWarnLinkStyleScopedTest 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_row_warn_link_style_is_scoped_under_platform_orders_table_only(): void
{
$this->loginAsPlatformAdmin();
$css = file_get_contents(public_path('css/admin-components.css'));
$this->assertIsString($css);
$this->assertStringContainsString('.platform-orders-table .row-warn a.link{', $css);
$this->assertStringContainsString('.platform-orders-table .row-warn a.link:hover{', $css);
// 防止写成全局 a.link{...} 或 .row-warn a.link{...}
$this->assertStringNotContainsString("\na.link{", $css);
$this->assertStringNotContainsString("\n.row-warn a.link{", $css);
}
}