补齐批次详情页访客与空态边界测试
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
</div>
|
||||
<div class="actions gap-10">
|
||||
<a class="btn btn-secondary btn-sm" href="{{ $backToListUrl }}">返回上一页</a>
|
||||
@if($runId !== '')
|
||||
@if(($error ?? '') === '' && $runId !== '')
|
||||
<button type="button" class="btn btn-secondary btn-sm" data-action="copy-run-id" data-run-id="{{ $runId }}">复制 run_id</button>
|
||||
@endif
|
||||
<a class="btn btn-secondary btn-sm" href="/admin/platform-batches/show?type={{ $type }}&run_id={{ urlencode($runId) }}&back={{ urlencode($selfWithoutBack) }}">刷新</a>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformBatchShowPageGuestCannotAccessTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_guest_cannot_access_platform_batch_show_page(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
$this->get('/admin/platform-batches/show?type=bas&run_id=BAS_GUEST_0001')
|
||||
->assertRedirect('/admin/login');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformBatchShowPageInvalidTypeAndEmptyStateTest 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_batch_show_page_should_render_error_when_type_is_invalid(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$html = $this->get('/admin/platform-batches/show?type=unknown&run_id=RUN_INVALID_TYPE_0001')
|
||||
->assertOk()
|
||||
->getContent();
|
||||
|
||||
$this->assertStringContainsString('参数不完整:请提供 type(bas/bmpa)与 run_id。', $html);
|
||||
$this->assertStringContainsString('href="/admin/platform-orders"', $html);
|
||||
$this->assertStringNotContainsString('data-action="copy-run-id"', $html);
|
||||
$this->assertStringNotContainsString('data-role="batch-spot-check-link"', $html);
|
||||
}
|
||||
|
||||
public function test_platform_batch_show_page_should_render_empty_batch_zero_state_when_run_id_has_no_orders(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$html = $this->get('/admin/platform-batches/show?type=bas&run_id=BAS_EMPTY_0001')
|
||||
->assertOk()
|
||||
->getContent();
|
||||
|
||||
$this->assertStringContainsString('BAS(批量同步订阅) 批次详情', $html);
|
||||
$this->assertStringContainsString('run_id:<strong>BAS_EMPTY_0001</strong>', $html);
|
||||
$this->assertStringContainsString('本批次尚未生成 last_result 汇总', $html);
|
||||
$this->assertStringContainsString('data-role="batch-matched-link"', $html);
|
||||
$this->assertStringContainsString('>0</a>', $html);
|
||||
$this->assertStringContainsString('暂无可抽样订单(可能暂无成功单,或 last_result 尚未补齐)。', $html);
|
||||
$this->assertStringContainsString('Top 失败原因', $html);
|
||||
$this->assertStringContainsString('暂无(last_result 未写入时不做原因聚合,以免在页面侧引入重查询)。', $html);
|
||||
$this->assertStringContainsString('batch_activation_run_id=BAS_EMPTY_0001', $html);
|
||||
$this->assertStringNotContainsString('data-role="batch-failed-ratio-link"', $html);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user