test(platform-orders): ensure bmpa_processable_only checkbox renders and keeps checked
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderFiltersShouldRenderBmpaProcessableOnlyCheckboxTest 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_filters_should_render_bmpa_processable_only_checkbox(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$html = $this->get('/admin/platform-orders')
|
||||
->assertOk()
|
||||
->getContent();
|
||||
|
||||
$this->assertStringContainsString('name="bmpa_processable_only"', $html);
|
||||
$this->assertStringContainsString('只看可BMPA处理', $html);
|
||||
}
|
||||
|
||||
public function test_platform_orders_filters_should_keep_checkbox_checked_when_enabled(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$html = $this->get('/admin/platform-orders?bmpa_processable_only=1')
|
||||
->assertOk()
|
||||
->getContent();
|
||||
|
||||
// Blade: @checked(...) will output checked="checked"
|
||||
$this->assertStringContainsString('name="bmpa_processable_only" value="1" checked', $html);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user