36 lines
1020 B
PHP
36 lines
1020 B
PHP
<?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();
|
|
|
|
// 续费选项应禁用
|
|
$res->assertSee('value="renewal" disabled', false);
|
|
|
|
// 不应出现 renewal 被选中(避免误导)
|
|
$res->assertDontSee('value="renewal" selected', false);
|
|
}
|
|
}
|