Files
saasshop/tests/Feature/AdminPlatformOrderIndexNoReceiptFixLinkShouldPointToAddPaymentReceiptPanelTest.php

55 lines
1.7 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace Tests\Feature;
use App\Models\Merchant;
use App\Models\PlatformOrder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderIndexNoReceiptFixLinkShouldPointToAddPaymentReceiptPanelTest 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_index_no_receipt_fix_link_should_point_to_add_payment_receipt_panel(): void
{
$this->loginAsPlatformAdmin();
$merchant = Merchant::query()->firstOrFail();
$order = PlatformOrder::query()->create([
'merchant_id' => $merchant->id,
'plan_id' => null,
'site_subscription_id' => null,
'order_no' => 'PO_INDEX_NO_RECEIPT_FIX_LINK',
'order_type' => 'new_purchase',
'status' => 'pending',
'payment_status' => 'paid',
'payable_amount' => 10,
'paid_amount' => 10,
'paid_at' => now(),
'meta' => [], // 无 payment_receipts / payment_summary
]);
$res = $this->get('/admin/platform-orders');
$res->assertOk();
$html = (string) $res->getContent();
// 无回执行应提供“去补回执”入口,且锚点必须为 #add-payment-receipt避免误跳到其它 section
$this->assertStringContainsString('无回执', $html);
$this->assertStringContainsString('/admin/platform-orders/' . $order->id, $html);
$this->assertStringContainsString('#add-payment-receipt', $html);
}
}