chore(governance): block batch activate when syncable_only conflicts with synced_only
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderBatchActivateSubscriptionsShouldBlockWhenSyncableOnlyConflictsWithSyncedOnlyTest 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_activate_should_block_when_syncable_only_and_synced_only_present(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->post('/admin/platform-orders/batch-activate-subscriptions', [
|
||||
'scope' => 'filtered',
|
||||
'syncable_only' => '1',
|
||||
'synced_only' => '1',
|
||||
'limit' => 50,
|
||||
]);
|
||||
|
||||
$res->assertRedirect();
|
||||
$res->assertSessionHas('warning');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderIndexBatchActivateButtonShouldDisableWhenSyncableOnlyAndSyncedOnlyTest 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_activate_button_should_disable_when_syncable_only_checked_but_synced_only_is_present(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
// syncable_only=1 语义为“未同步且非失败”,与 synced_only=1(已同步)互斥。
|
||||
$res = $this->get('/admin/platform-orders?syncable_only=1&synced_only=1');
|
||||
$res->assertOk();
|
||||
|
||||
$html = (string) $res->getContent();
|
||||
|
||||
$this->assertStringContainsString('批量同步订阅(当前筛选范围)', $html);
|
||||
$this->assertStringContainsString('data-role="batch-activate-subscriptions-blocked-hint"', $html);
|
||||
$this->assertStringContainsString('只看已同步', $html);
|
||||
|
||||
$this->assertTrue(str_contains($html, 'type="submit" disabled') || str_contains($html, 'disabled="disabled"'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user