Files
saasshop/tests/Feature/AdminPlatformOrderIndexToolGroupsShouldHaveDataRoleAndAriaLabelTest.php

49 lines
1.8 KiB
PHP

<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderIndexToolGroupsShouldHaveDataRoleAndAriaLabelTest 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_platform_orders_index_tool_groups_should_have_data_role_and_aria_label(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/platform-orders');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('data-role="po-tools-grid"', $html);
$this->assertStringContainsString('aria-label="平台订单工具区网格"', $html);
$expectedGroups = [
'po-tools-group-export' => '平台订单导出工具组',
'po-tools-group-batch-activate-subscriptions' => '平台订单批量同步订阅工具组',
'po-tools-group-batch-bmpa' => '平台订单批量标记支付并生效工具组',
'po-tools-group-batch-mark-activated' => '平台订单批量仅标记为已生效工具组',
'po-tools-group-clear-sync-errors' => '平台订单清理同步失败标记工具组',
'po-tools-group-clear-bmpa-errors' => '平台订单清理批量BMPA失败标记工具组',
];
foreach ($expectedGroups as $role => $ariaLabel) {
$this->assertStringContainsString("data-role=\"{$role}\"", $html);
$this->assertStringContainsString("aria-label=\"{$ariaLabel}\"", $html);
}
}
}