<?php

namespace Tests\Feature;

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

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

        // 构造一个简单的分页器，直接渲染 links()，避免依赖 seed 数据量。
        $p = new \Illuminate\Pagination\LengthAwarePaginator(
            collect([1, 2, 3, 4, 5, 6]),
            6,
            2,
            2,
            ['path' => '/admin/products']
        );

        $html = (string) $p->links();

        // 护栏：自定义分页模板必须输出统一的 admin pagination class。
        $this->assertStringContainsString('adm-pagination', $html);
        $this->assertStringContainsString('adm-page-num', $html);
    }
}
