65 lines
2.0 KiB
PHP
65 lines
2.0 KiB
PHP
<?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 AdminDashboardRecentPlatformOrdersPaidNoReceiptPrefixShouldUsePaidNoReceiptPhraseTest 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_recent_platform_orders_paid_no_receipt_prefix_should_use_paid_no_receipt_phrase(): void
|
|
{
|
|
$this->loginAsPlatformAdmin();
|
|
|
|
$merchant = Merchant::query()->firstOrFail();
|
|
$plan = Plan::query()->create([
|
|
'code' => 'dashboard_recent_paid_no_receipt_prefix_plan',
|
|
'name' => '仪表盘最近订单已付无回执前缀测试套餐',
|
|
'billing_cycle' => 'monthly',
|
|
'price' => 10,
|
|
'list_price' => 10,
|
|
'status' => 'active',
|
|
'sort' => 10,
|
|
'published_at' => now(),
|
|
]);
|
|
|
|
PlatformOrder::query()->create([
|
|
'merchant_id' => $merchant->id,
|
|
'plan_id' => $plan->id,
|
|
'order_no' => 'PO_DASHBOARD_PNR_PREFIX_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' => [],
|
|
]);
|
|
|
|
$res = $this->get('/admin');
|
|
$res->assertOk();
|
|
$res->assertSee('<span class="row-warn-prefix">已付无回执</span>', false);
|
|
}
|
|
}
|