fix: 订阅批量过期动作透传 ends_at 区间筛选

This commit is contained in:
萝卜
2026-03-17 06:27:34 +08:00
parent f39fb9ebcd
commit 0b2f0c7d74
4 changed files with 88 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminSiteSubscriptionIndexBatchMarkExpiredBlockedHintShouldIncludeGoExpiredLinkTest 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_blocked_hint_should_include_link_to_expired_scope(): void
{
$this->loginAsPlatformAdmin();
// 不在 expiry=expired 集合时,按钮应禁用并出现 blocked hint + 一键跳转。
$res = $this->get('/admin/site-subscriptions');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('data-role="batch-mark-expired-blocked-hint"', $html);
$this->assertStringContainsString('切到已过期集合', $html);
$this->assertStringContainsString('expiry=expired', $html);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminSiteSubscriptionIndexBatchMarkExpiredFormShouldKeepEndsAtRangeFiltersTest 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_batch_mark_expired_form_should_keep_ends_at_range_filters(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/site-subscriptions?expiry=expired&ends_from=2026-03-01&ends_to=2026-03-31');
$res->assertOk();
$res->assertSee('name="ends_from" value="2026-03-01"', false);
$res->assertSee('name="ends_to" value="2026-03-31"', false);
}
}