Files
saasshop/tests/Feature/AdminPlatformOrderCreateRequireSubscriptionFlagShouldDisableRenewalTest.php

35 lines
1.1 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 Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderCreateRequireSubscriptionFlagShouldDisableRenewalTest 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_create_should_not_allow_renewal_default_when_require_subscription_flag_and_subscription_missing(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/platform-orders/create?require_subscription=1&order_type=renewal');
$res->assertOk();
// 当 require_subscription=1 且未绑定订阅时:续费选项不应可选(可能被隐藏或 disabled
$res->assertDontSee('value="renewal" selected', false);
// 更强口径:不应出现 renewal option避免误导
$res->assertDontSee('value="renewal"', false);
}
}