diff --git a/resources/views/admin/platform_batches/show.blade.php b/resources/views/admin/platform_batches/show.blade.php index 8ea184b..46d82c7 100644 --- a/resources/views/admin/platform_batches/show.blade.php +++ b/resources/views/admin/platform_batches/show.blade.php @@ -43,7 +43,7 @@
返回上一页 - @if($runId !== '') + @if(($error ?? '') === '' && $runId !== '') @endif 刷新 diff --git a/tests/Feature/AdminPlatformBatchShowPageGuestCannotAccessTest.php b/tests/Feature/AdminPlatformBatchShowPageGuestCannotAccessTest.php new file mode 100644 index 0000000..08b11ac --- /dev/null +++ b/tests/Feature/AdminPlatformBatchShowPageGuestCannotAccessTest.php @@ -0,0 +1,19 @@ +seed(); + + $this->get('/admin/platform-batches/show?type=bas&run_id=BAS_GUEST_0001') + ->assertRedirect('/admin/login'); + } +} diff --git a/tests/Feature/AdminPlatformBatchShowPageInvalidTypeAndEmptyStateTest.php b/tests/Feature/AdminPlatformBatchShowPageInvalidTypeAndEmptyStateTest.php new file mode 100644 index 0000000..c6bd82e --- /dev/null +++ b/tests/Feature/AdminPlatformBatchShowPageInvalidTypeAndEmptyStateTest.php @@ -0,0 +1,55 @@ +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:BAS_EMPTY_0001', $html); + $this->assertStringContainsString('本批次尚未生成 last_result 汇总', $html); + $this->assertStringContainsString('data-role="batch-matched-link"', $html); + $this->assertStringContainsString('>0', $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); + } +}