Files
saasshop/tests/Feature/AdminPlatformBatchShowPageCopyGovernanceLinksButtonsShouldRenderTest.php

50 lines
1.8 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformBatchShowPageCopyGovernanceLinksButtonsShouldRenderTest 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_batch_show_page_should_render_copy_buttons_for_governance_links_when_present(): void
{
$this->loginAsPlatformAdmin();
// 不依赖 DB该页面即使 summary 缺失也会渲染治理入口(本批次失败/按Top原因是否存在取决于 controller summary。
// 这里用 BAS + 任意 run_id只校验按钮结构存在治理链接内容在其它测试已覆盖。
$runId = 'BAS_COPY_LINKS_0001';
// 该 run_id 在空库下 summary 为空controller 仍会生成 failed/all/retry 链接,因此“本批次失败”应存在。
$html = $this->get('/admin/platform-batches/show?type=bas&run_id=' . $runId)
->assertOk()
->getContent();
$this->assertStringContainsString('data-action="copy-link"', $html);
// 已存在:本批次失败 / 按Top原因
$this->assertStringContainsString('data-role="copy-failed-link"', $html);
// 新增:本批次全部
$this->assertStringContainsString('data-role="copy-all-link"', $html);
// 新增本批次成功BASsync_status=synced
$this->assertStringContainsString('data-role="copy-success-link"', $html);
// 新增本批次可同步重试BAS
$this->assertStringContainsString('data-role="copy-retry-syncable-link"', $html);
}
}