47 lines
1.7 KiB
PHP
47 lines
1.7 KiB
PHP
<?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);
|
||
|
||
// 新增:本批次可同步重试(BAS)
|
||
$this->assertStringContainsString('data-role="copy-retry-syncable-link"', $html);
|
||
}
|
||
}
|