平台订单:同步失败原因TOP5补齐可同步重试入口
This commit is contained in:
@@ -243,6 +243,8 @@
|
||||
<div>
|
||||
<a class="link" href="{!! request()->fullUrlWithQuery(['sync_error_keyword' => $reason, 'sync_status' => 'failed', 'page' => null]) !!}">{{ $reason }}</a>
|
||||
<span class="muted">({{ $item['count'] }})</span>
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! request()->fullUrlWithQuery(['sync_error_keyword' => $reason, 'sync_status' => null, 'syncable_only' => '1', 'page' => null]) !!}">切到可同步重试</a>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Merchant;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlatformOrder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderSyncFailedReasonTop5RetryLinkTest 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_sync_failed_reason_top5_shows_retry_link_to_syncable_only_scope(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'sync_failed_reason_retry_link_test',
|
||||
'name' => '同步失败原因重试链接测试套餐',
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => 10,
|
||||
'list_price' => 10,
|
||||
'status' => 'active',
|
||||
'sort' => 10,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
// 构造一条失败原因数据,触发 TOP5
|
||||
PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'order_no' => 'PO_SYNC_FAILED_REASON_0001',
|
||||
'order_type' => 'new_purchase',
|
||||
'status' => 'activated',
|
||||
'payment_status' => 'paid',
|
||||
'plan_name' => $plan->name,
|
||||
'billing_cycle' => $plan->billing_cycle,
|
||||
'period_months' => 1,
|
||||
'quantity' => 1,
|
||||
'payable_amount' => 10,
|
||||
'paid_amount' => 10,
|
||||
'placed_at' => now(),
|
||||
'paid_at' => now(),
|
||||
'activated_at' => now(),
|
||||
'meta' => [
|
||||
'subscription_activation_error' => [
|
||||
'message' => '模拟失败原因TOP5',
|
||||
'at' => now()->toDateTimeString(),
|
||||
'admin_id' => 1,
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$page = $this->get('/admin/platform-orders');
|
||||
$page->assertOk();
|
||||
|
||||
// 失败原因链接存在
|
||||
$page->assertSee('sync_status=failed', false);
|
||||
$page->assertSee('sync_error_keyword=', false);
|
||||
|
||||
// “切到可同步重试”链接存在:应包含 syncable_only=1,并不应包含 sync_status=failed
|
||||
$page->assertSee('切到可同步重试');
|
||||
$page->assertSee('syncable_only=1', false);
|
||||
$page->assertDontSee('sync_status=failed&syncable_only=1', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user