<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminMerchantIndexUsesExternalCssTest 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_admin_merchants_index_should_not_include_inline_style_blocks(): void
    {
        $this->loginAsPlatformAdmin();

        $res = $this->get('/admin/merchants');
        $res->assertOk();

        $html = (string) $res->getContent();

        // 样式治理：后台页面不应新增大段 inline <style>
        $this->assertStringNotContainsString('<style', $html);

        // 并且应包含统一的后台样式文件
        $this->assertStringContainsString('/css/admin-components.css', $html);
    }
}
