PlatformOrder create: add jump to subscriptions link when require_subscription

This commit is contained in:
萝卜
2026-03-15 02:41:29 +00:00
parent 3182dd72a0
commit df416da7f8
2 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Arr;
use Tests\TestCase;
class AdminPlatformOrderCreateRequireSubscriptionFlagShouldRenderJumpToSubscriptionsLinkTest 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_render_jump_to_subscriptions_link_when_require_subscription_flag_and_no_subscription_context(): void
{
$this->loginAsPlatformAdmin();
$url = '/admin/platform-orders/create?' . Arr::query([
'require_subscription' => 1,
'merchant_id' => 2,
'plan_id' => 3,
]);
$res = $this->get($url);
$res->assertOk();
$res->assertSee('去订阅管理选择订阅', false);
$res->assertSee('/admin/site-subscriptions?merchant_id=2&plan_id=3', false);
// 链接应携带 back
$res->assertSee('back=', false);
}
}