43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?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);
|
|
}
|
|
}
|