chore(governance): block batch activate when syncable_only conflicts with failed filters

This commit is contained in:
萝卜
2026-03-16 21:05:13 +08:00
parent 6790771364
commit 512de34da4
2 changed files with 64 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderBatchActivateSubscriptionsShouldBlockWhenSyncableOnlyConflictsWithSyncStatusTest 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_warn_and_block_when_syncable_only_and_sync_status_failed_present(): void
{
$this->loginAsPlatformAdmin();
$res = $this->post('/admin/platform-orders/batch-activate-subscriptions', [
'scope' => 'filtered',
'syncable_only' => '1',
'sync_status' => 'failed',
'limit' => 50,
]);
$res->assertRedirect();
$res->assertSessionHas('warning');
}
public function test_batch_activate_should_warn_and_block_when_syncable_only_and_sync_error_keyword_present(): void
{
$this->loginAsPlatformAdmin();
$res = $this->post('/admin/platform-orders/batch-activate-subscriptions', [
'scope' => 'filtered',
'syncable_only' => '1',
'sync_error_keyword' => 'demo',
'limit' => 50,
]);
$res->assertRedirect();
$res->assertSessionHas('warning');
}
}