Files
saasshop/tests/Feature/AdminMerchantIndexGovernanceLinksShouldIncludeRenewalMissingSubscriptionTest.php

43 lines
1.3 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\Merchant;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminMerchantIndexGovernanceLinksShouldIncludeRenewalMissingSubscriptionTest 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_merchants_index_should_include_governance_links_with_back(): void
{
$this->loginAsPlatformAdmin();
$merchant = Merchant::query()->firstOrFail();
$res = $this->get('/admin/merchants');
$res->assertOk();
$html = (string) $res->getContent();
// 站点治理入口:订阅/平台订单/续费缺订阅
$this->assertStringContainsString('/admin/site-subscriptions?merchant_id=' . $merchant->id, $html);
$this->assertStringContainsString('/admin/platform-orders?merchant_id=' . $merchant->id, $html);
$this->assertStringContainsString('renewal_missing_subscription=1', $html);
// back 应回到站点管理页
$this->assertStringContainsString('back=' . urlencode('/admin/merchants'), $html);
}
}