50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Merchant;
|
|
use App\Models\SiteSubscription;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class AdminSiteSubscriptionShowSetStatusFormShouldDisableOnSubmitTest 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_show_set_status_form_should_disable_on_submit(): void
|
|
{
|
|
$this->loginAsPlatformAdmin();
|
|
|
|
$merchant = Merchant::query()->firstOrFail();
|
|
|
|
$sub = SiteSubscription::query()->create([
|
|
'merchant_id' => $merchant->id,
|
|
'status' => 'pending',
|
|
'source' => 'manual',
|
|
'subscription_no' => 'SUB_SHOW_SET_STATUS_DISABLE_0001',
|
|
'plan_name' => '测试套餐',
|
|
'billing_cycle' => 'monthly',
|
|
'period_months' => 1,
|
|
'amount' => 10,
|
|
'starts_at' => now()->subDay(),
|
|
'ends_at' => now()->addDays(29),
|
|
]);
|
|
|
|
$res = $this->get('/admin/site-subscriptions/' . $sub->id);
|
|
$res->assertOk();
|
|
|
|
$res->assertSee('action="/admin/site-subscriptions/' . $sub->id . '/set-status"', false);
|
|
$res->assertSee('data-action="disable-on-submit"', false);
|
|
}
|
|
}
|