chore(admin-dashboard): show reason-too-long hint when same-reason link omitted
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Admin;
|
||||
use App\Models\Merchant;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlatformOrder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminDashboardRecentPlatformOrdersFailedHintsShouldShowReasonTooLongHintWhenNoSameReasonLinkTest 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_dashboard_recent_platform_orders_failed_hints_should_show_reason_too_long_hint_when_no_same_reason_link(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchantId = (int) Merchant::query()->value('id');
|
||||
$platformAdminId = (int) Admin::query()->where('email', 'platform.admin@demo.local')->value('id');
|
||||
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'dash_failed_reason_too_long_plan',
|
||||
'name' => '仪表盘原因过长提示测试套餐',
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => 10,
|
||||
'list_price' => 10,
|
||||
'status' => 'active',
|
||||
'sort' => 10,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
$longReason = str_repeat('A', 120);
|
||||
|
||||
PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchantId,
|
||||
'plan_id' => $plan->id,
|
||||
'site_subscription_id' => null,
|
||||
'created_by_admin_id' => $platformAdminId ?: null,
|
||||
'order_no' => 'PO_DASH_SYNC_FAIL_LONG_REASON_0001',
|
||||
'order_type' => 'new_purchase',
|
||||
'status' => 'pending',
|
||||
'payment_status' => 'paid',
|
||||
'payable_amount' => 10,
|
||||
'paid_amount' => 10,
|
||||
'meta' => [
|
||||
'subscription_activation_error' => [
|
||||
'message' => $longReason,
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchantId,
|
||||
'plan_id' => $plan->id,
|
||||
'site_subscription_id' => null,
|
||||
'created_by_admin_id' => $platformAdminId ?: null,
|
||||
'order_no' => 'PO_DASH_BMPA_FAIL_LONG_REASON_0001',
|
||||
'order_type' => 'new_purchase',
|
||||
'status' => 'pending',
|
||||
'payment_status' => 'unpaid',
|
||||
'payable_amount' => 10,
|
||||
'paid_amount' => 0,
|
||||
'meta' => [
|
||||
'batch_mark_paid_and_activate_error' => [
|
||||
'message' => $longReason,
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$res = $this->get('/admin');
|
||||
$res->assertOk();
|
||||
|
||||
// 原因过长时不生成同原因集合链接,但应提示“原因过长”避免运营以为缺入口。
|
||||
$res->assertSee('原因过长', false);
|
||||
|
||||
// 不应出现同原因集合链接
|
||||
$res->assertDontSee('同原因集合', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user