PlatformOrder create: require_subscription flag narrows order types
This commit is contained in:
@@ -26,10 +26,9 @@ class AdminPlatformOrderCreateRequireSubscriptionFlagShouldDisableRenewalTest ex
|
||||
$res = $this->get('/admin/platform-orders/create?require_subscription=1&order_type=renewal');
|
||||
$res->assertOk();
|
||||
|
||||
// 续费选项应禁用
|
||||
$res->assertSee('value="renewal" disabled', false);
|
||||
|
||||
// 不应出现 renewal 被选中(避免误导)
|
||||
// 当 require_subscription=1 且未绑定订阅时:续费选项不应可选(可能被隐藏或 disabled)
|
||||
$res->assertDontSee('value="renewal" selected', false);
|
||||
// 更强口径:不应出现 renewal option(避免误导)
|
||||
$res->assertDontSee('value="renewal"', false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderCreateRequireSubscriptionFlagShouldOnlyShowNewPurchaseTypeTest 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_only_show_new_purchase_when_require_subscription_flag_and_no_subscription_context(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->get('/admin/platform-orders/create?require_subscription=1');
|
||||
$res->assertOk();
|
||||
|
||||
// 仅保留 new_purchase 作为可选项(避免误用 upgrade/downgrade 等)
|
||||
$res->assertSee('value="new_purchase"', false);
|
||||
$res->assertDontSee('value="upgrade"', false);
|
||||
$res->assertDontSee('value="downgrade"', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user