chore(governance): block batch mark activated when receipt none/refund has
This commit is contained in:
@@ -86,17 +86,21 @@ class AdminPlatformOrderBatchMarkActivatedRefundStatusFilterFieldsTest extends T
|
||||
$page->assertSee('name="refund_status"', false);
|
||||
$page->assertSee('value="none"', false);
|
||||
|
||||
$this->post('/admin/platform-orders/batch-mark-activated', [
|
||||
$res = $this->post('/admin/platform-orders/batch-mark-activated', [
|
||||
'scope' => 'filtered',
|
||||
'payment_status' => 'paid',
|
||||
'status' => 'pending',
|
||||
'sync_status' => 'unsynced',
|
||||
'refund_status' => 'none',
|
||||
'limit' => 50,
|
||||
])->assertRedirect();
|
||||
]);
|
||||
|
||||
$res->assertRedirect();
|
||||
|
||||
$a->refresh();
|
||||
$b->refresh();
|
||||
|
||||
// 口径升级:只允许在“无退款”集合上推进;因此 A 会被推进、B 保持 pending。
|
||||
$this->assertSame('activated', $a->status);
|
||||
$this->assertSame('pending', $b->status);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderBatchMarkActivatedShouldBlockWhenReceiptStatusNoneTest 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_mark_activated_should_block_when_receipt_status_none_is_set(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->post('/admin/platform-orders/batch-mark-activated', [
|
||||
'scope' => 'filtered',
|
||||
'payment_status' => 'paid',
|
||||
'status' => 'pending',
|
||||
'sync_status' => 'unsynced',
|
||||
'receipt_status' => 'none',
|
||||
'limit' => 50,
|
||||
]);
|
||||
|
||||
$res->assertRedirect();
|
||||
$res->assertSessionHas('warning');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderBatchMarkActivatedShouldBlockWhenRefundStatusHasTest 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_mark_activated_should_block_when_refund_status_has_is_set(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->post('/admin/platform-orders/batch-mark-activated', [
|
||||
'scope' => 'filtered',
|
||||
'payment_status' => 'paid',
|
||||
'status' => 'pending',
|
||||
'sync_status' => 'unsynced',
|
||||
'refund_status' => 'has',
|
||||
'limit' => 50,
|
||||
]);
|
||||
|
||||
$res->assertRedirect();
|
||||
$res->assertSessionHas('warning');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderIndexBatchMarkActivatedButtonShouldDisableWhenReceiptStatusNoneTest 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_mark_activated_button_should_disable_when_receipt_status_none_even_if_paid_pending(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->get('/admin/platform-orders?payment_status=paid&status=pending&sync_status=unsynced&receipt_status=none');
|
||||
$res->assertOk();
|
||||
|
||||
$html = (string) $res->getContent();
|
||||
|
||||
$this->assertStringContainsString('批量仅标记为已生效(当前筛选范围)', $html);
|
||||
$this->assertStringContainsString('data-role="batch-mark-activated-blocked-hint"', $html);
|
||||
$this->assertStringContainsString('无回执', $html);
|
||||
|
||||
$this->assertTrue(str_contains($html, 'type="submit" disabled') || str_contains($html, 'disabled="disabled"'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderIndexBatchMarkActivatedButtonShouldDisableWhenRefundStatusHasTest 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_mark_activated_button_should_disable_when_refund_status_has_even_if_paid_pending(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->get('/admin/platform-orders?payment_status=paid&status=pending&sync_status=unsynced&refund_status=has');
|
||||
$res->assertOk();
|
||||
|
||||
$html = (string) $res->getContent();
|
||||
|
||||
$this->assertStringContainsString('批量仅标记为已生效(当前筛选范围)', $html);
|
||||
$this->assertStringContainsString('data-role="batch-mark-activated-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