CaiWuXiTong/tests/Feature/Business/NonStoreAccountMonitorTest.php
shanshi 00c1846be6 fix: 移除保留账户旧网银钱包并统一返回入口
旧网银钱包仅保留在不保留账户;账户总览及账户档案相关返回按钮统一回到账户总览入口。
2026-11-18 16:09:05 +08:00

593 lines
29 KiB
PHP

<?php
namespace Tests\Feature\Business;
use App\Models\Auth\Permission;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Tests\Feature\FeatureTestCase;
class NonStoreAccountMonitorTest extends FeatureTestCase
{
protected function setUp(): void
{
parent::setUp();
Carbon::setTestNow('2026-11-17 10:30:00');
$this->user->attachPermission(
Permission::where('name', 'read-admin-panel')->firstOrFail(),
);
$connection = DB::connection('business_mirror');
foreach ([
[
'company_name' => '保留直连公司',
'account_short' => '保留直连工行',
'account_type' => '公户',
'bank_name' => '中国工商银行上海分行',
'account_no' => '100200300400',
'single_limit' => '50000',
'daily_limit' => '100000',
'monthly_limit' => '500000',
'yearly_limit' => '5000000',
'account_should_keep' => '是',
'current_balance' => 100000,
'daily_available' => 80000,
'blocked_amount' => 20000,
'owner' => '张三',
'remark' => '保留账户备注',
],
[
'company_name' => '保留手动公司',
'account_short' => '保留手动支付宝',
'account_type' => '支付宝',
'account_no' => 'alipay@example.com',
'alipay_merchant_no' => '20880001',
'alipay_account_kind' => '企业支付宝',
'account_should_keep' => '是',
'current_balance' => 50000,
'daily_available' => 50000,
'blocked_amount' => 0,
],
[
'company_name' => '不保留银行公司',
'account_short' => '不保留华夏',
'account_type' => '公户',
'bank_name' => '华夏银行常州分行',
'account_no' => '131500000001',
'account_should_keep' => '否',
'current_balance' => 30000,
'daily_available' => 30000,
'blocked_amount' => 0,
],
[
'company_name' => '不保留网商公司',
'account_short' => '不保留网商',
'account_type' => '网商银行',
'account_no' => 'wangshang@example.com',
'account_should_keep' => '否',
'current_balance' => 12000,
'daily_available' => 10000,
'blocked_amount' => 2000,
],
] as $account) {
$connection->table('fin_accounts')->insert($account);
}
$connection->table('fin_flow_summary_account_sources')->insert([
['account_short' => '保留直连工行', 'data_source' => '银企直连', 'updated_by' => '测试'],
['account_short' => '保留手动支付宝', 'data_source' => '手动', 'updated_by' => '测试'],
['account_short' => '不保留华夏', 'data_source' => '手动', 'updated_by' => '测试'],
['account_short' => '不保留网商', 'data_source' => '手动', 'updated_by' => '测试'],
]);
foreach ([
[
'account_short' => '不保留华夏',
'owner_name' => '财务甲乙',
'started_at' => '2026-11-16',
'completed_at' => '2026-11-17',
'current_progress' => 'completed',
'updated_by' => '测试',
],
[
'account_short' => '不保留网商',
'owner_name' => '财务丙',
'started_at' => '2026-11-17',
'current_progress' => 'in_progress',
'updated_by' => '测试',
],
] as $task) {
$connection->table('fin_account_keep_todos')->insert($task);
}
$connection->table('fin_daily_flows')->insert([
[
'flow_date' => '2026-10-31',
'account_short' => '保留直连工行',
'opening_balance' => 80000,
'inflow' => 10000,
'outflow' => 0,
'closing_balance' => 90000,
],
[
'flow_date' => '2026-11-01',
'account_short' => '保留直连工行',
'opening_balance' => 90000,
'inflow' => 20000,
'outflow' => 10000,
'closing_balance' => 100000,
],
]);
}
protected function tearDown(): void
{
Carbon::setTestNow();
parent::tearDown();
}
public function test_overview_separates_retained_and_unretained_accounts(): void
{
$html = $this->loginAs()->get($this->pageUrl())->assertOk()->getContent();
$this->assertStringContainsString('<h2>账户总览</h2>', $html);
$this->assertStringContainsString('保留账户资金总览', $html);
$this->assertStringContainsString('data-retained-open', $html);
$this->assertStringContainsString('data-unretained-open', $html);
$this->assertStringContainsString('data-unretained-dialog', $html);
$this->assertStringContainsString('data-unretained-distribution', $html);
$this->assertStringContainsString('保留账户', $html);
$this->assertStringContainsString('不保留账户', $html);
$this->assertStringContainsString('旧网银钱包', $html);
$this->assertStringContainsString('nsm-column-filter-panel', $html);
$this->assertStringContainsString('width: min(13rem, calc(100vw - 1rem))', $html);
$this->assertStringContainsString('width: min(17rem, calc(100vw - 1rem))', $html);
$this->assertStringContainsString('filterPanel.style.maxHeight', $html);
$this->assertStringContainsString('nsm-column-filter-panel.is-options-open', $html);
$this->assertStringContainsString('模糊搜索筛选项', $html);
$this->assertStringContainsString('data-nsm-filter-sort="asc"', $html);
$this->assertStringContainsString('data-nsm-filter-sort="desc"', $html);
$this->assertStringContainsString('查看处理进度清单', $html);
$this->assertStringContainsString('银企直连', $html);
$this->assertStringContainsString('非银企直连', $html);
$this->assertStringContainsString('15.00 万元', $html);
$this->assertStringContainsString('4.20 万元', $html);
$this->assertStringContainsString('<span>当前总余额</span>', $html);
$this->assertStringContainsString('<strong>15.00</strong>', $html);
$this->assertStringContainsString('<span>可用金额</span>', $html);
$this->assertStringContainsString('<strong>13.00</strong>', $html);
$this->assertStringContainsString('<span>不可用金额</span>', $html);
$this->assertStringContainsString('<strong>2.00</strong>', $html);
$this->assertStringContainsString('<span>保留账户数</span>', $html);
}
public function test_fund_overview_is_inside_retained_dialog_and_groups_by_platform(): void
{
DB::connection('business_mirror')->table('fin_accounts')->insert([
'company_name' => '保留网商公司',
'account_short' => '保留网商账户',
'account_type' => '网商银行',
'account_should_keep' => '是',
'current_balance' => 8000,
'daily_available' => 8000,
'blocked_amount' => 0,
]);
$html = $this->loginAs()->get($this->pageUrl())->assertOk()->getContent();
$this->assertStringNotContainsString('data-fund-overview-open', $html);
$this->assertStringNotContainsString('data-fund-distribution-dialog', $html);
$this->assertStringContainsString('data-retained-fund-overview', $html);
$this->assertStringContainsString('data-retained-fund-distribution', $html);
$this->assertStringContainsString('账户平台资金分布', $html);
$this->assertStringContainsString('余额占比', $html);
$this->assertStringContainsString('<td>银行账户</td>', $html);
$this->assertStringContainsString('<td>支付宝</td>', $html);
$this->assertStringContainsString('data-bank-drilldown-open', $html);
$this->assertStringContainsString('data-bank-drilldown', $html);
$this->assertStringContainsString('data-bank-count-menu', $html);
$this->assertStringContainsString('data-bank-mode="all"', $html);
$this->assertStringContainsString('data-bank-mode="direct"', $html);
$this->assertStringContainsString('data-bank-panel="all"', $html);
$this->assertStringContainsString('data-bank-panel="direct"', $html);
$this->assertStringContainsString('aria-controls="nsm-bank-drilldown"', $html);
$this->assertStringContainsString('aria-expanded="false"', $html);
$this->assertStringContainsString('data-connection-toggle="direct"', $html);
$this->assertStringContainsString('data-connection-panel="direct"', $html);
$this->assertStringContainsString('data-connection-toggle="non_direct"', $html);
$this->assertStringContainsString('data-connection-panel="non_direct"', $html);
$this->assertStringContainsString('data-connection-toggle="bank_category"', $html);
$this->assertStringContainsString('data-connection-panel="bank_category"', $html);
$this->assertStringContainsString('aria-controls="nsm-connection-panel-bank-category"', $html);
$this->assertStringContainsString('data-platform-account-open="alipay"', $html);
$this->assertStringContainsString('data-platform-account-detail="alipay"', $html);
$this->assertStringContainsString('data-platform-account-open="wangshang"', $html);
$this->assertStringContainsString('data-platform-account-detail="wangshang"', $html);
$retainedDialog = $this->dialogHtml($html, 'data-retained-dialog');
$unretainedDialog = $this->dialogHtml($html, 'data-unretained-dialog');
$this->assertStringNotContainsString('<td>旧网银钱包</td>', $retainedDialog);
$this->assertStringNotContainsString('data-platform-account-open="legacy_wallet"', $retainedDialog);
$this->assertStringNotContainsString('data-platform-account-detail="legacy_wallet"', $retainedDialog);
$this->assertStringContainsString('<td>旧网银钱包</td>', $unretainedDialog);
$this->assertStringContainsString('data-platform-account-open="legacy_wallet"', $unretainedDialog);
$this->assertStringContainsString('data-platform-account-detail="legacy_wallet"', $unretainedDialog);
$this->assertStringContainsString('data-account-archive-open', $html);
$this->assertStringContainsString('account_category=all', $html);
$this->assertStringContainsString('<td>工商银行</td>', $html);
$this->assertStringNotContainsString('bank_group=%E5%8D%8E%E5%A4%8F%E9%93%B6%E8%A1%8C', $html);
}
public function test_independent_monthly_accounts_are_included_as_other_accounts(): void
{
$connection = DB::connection('business_mirror');
$connection->table('fin_accounts')->insert([
[
'company_name' => '朱俊祥',
'account_short' => '朱俊祥支付宝',
'account_type' => '支付宝',
'account_should_keep' => '是',
'current_balance' => 10000,
'daily_available' => 10000,
'blocked_amount' => 0,
],
[
'company_name' => '朱俊祥',
'account_short' => '朱俊祥微信',
'account_type' => null,
'account_should_keep' => '是',
'current_balance' => 20000,
'daily_available' => 20000,
'blocked_amount' => 0,
],
]);
$overviewHtml = $this->loginAs()->get($this->pageUrl())->assertOk()->getContent();
$this->assertStringContainsString('<td>其他账户</td>', $overviewHtml);
$this->assertStringContainsString('data-platform-account-open="other"', $overviewHtml);
$this->assertStringContainsString('data-platform-account-detail="other"', $overviewHtml);
$this->assertStringContainsString('aria-controls="nsm-other-drilldown"', $overviewHtml);
$this->assertStringContainsString('data-independent-account-open', $overviewHtml);
$this->assertStringContainsString('data-independent-account-view="zhu-junxiang-alipay"', $overviewHtml);
$this->assertStringContainsString('data-independent-account-view="zhu-junxiang-wechat"', $overviewHtml);
$this->assertStringContainsString('data-independent-account-frame', $overviewHtml);
$this->assertStringContainsString('ledger_embed=1', $overviewHtml);
$this->assertStringContainsString('朱俊祥支付宝', $overviewHtml);
$this->assertStringContainsString('朱俊祥微信', $overviewHtml);
$otherAccountsHtml = $this->loginAs()->get($this->pageUrl([
'view' => 'accounts',
'keep' => 'retained',
'account_category' => 'other',
]))->assertOk()->getContent();
$this->assertStringContainsString('朱俊祥支付宝', $otherAccountsHtml);
$this->assertStringContainsString('朱俊祥微信', $otherAccountsHtml);
$this->assertStringNotContainsString('保留手动支付宝', $otherAccountsHtml);
$embeddedHtml = $this->loginAs()->get(route('business.pages.show', [
'section' => 'financial-operations',
'page' => 'ledger',
]) . '?tab=transactions&txns_view=zhu-junxiang-alipay&ledger_embed=1')
->assertOk()
->getContent();
$this->assertStringContainsString('data-ledger-embed="1"', $embeddedHtml);
$this->assertStringContainsString('html[data-ledger-embed]', $embeddedHtml);
$this->assertStringContainsString('<input type="hidden" name="ledger_embed" value="1">', $embeddedHtml);
$this->assertStringContainsString('txns_view=zhu-junxiang-alipay&amp;ledger_embed=1', $embeddedHtml);
$this->assertStringContainsString('当前为“朱俊祥支付宝”独立账单页', $embeddedHtml);
}
public function test_legacy_wallet_accounts_are_always_unretained(): void
{
DB::connection('business_mirror')->table('fin_accounts')->insert([
'company_name' => '旧钱包公司',
'account_short' => '测试旧网银钱包',
'account_type' => '旧网银钱包',
'company_plan' => '保留',
'account_should_keep' => '是',
'current_balance' => 1234.56,
'daily_available' => 1234.56,
'blocked_amount' => 0,
]);
$overviewHtml = $this->loginAs()->get($this->pageUrl())->assertOk()->getContent();
$retainedDialog = $this->dialogHtml($overviewHtml, 'data-retained-dialog');
$unretainedDialog = $this->dialogHtml($overviewHtml, 'data-unretained-dialog');
$this->assertStringNotContainsString('旧网银钱包', $retainedDialog);
$this->assertStringNotContainsString('测试旧网银钱包', $retainedDialog);
$this->assertStringContainsString('data-platform-account-open="legacy_wallet"', $unretainedDialog);
$this->assertStringContainsString('测试旧网银钱包', $unretainedDialog);
$retainedHtml = $this->loginAs()->get($this->pageUrl([
'view' => 'accounts',
'account_category' => 'all',
]))->assertOk()->getContent();
$this->assertStringNotContainsString('测试旧网银钱包', $retainedHtml);
$this->assertStringNotContainsString('value="legacy_wallet"', $retainedHtml);
$this->assertStringNotContainsString('account_category=legacy_wallet', $retainedHtml);
$unretainedHtml = $this->loginAs()->get($this->pageUrl([
'view' => 'unretained_tasks',
'task_category' => 'legacy_wallet',
]))->assertOk()->getContent();
$this->assertStringContainsString('测试旧网银钱包', $unretainedHtml);
}
public function test_account_view_switches_columns_with_account_type(): void
{
$alipayHtml = $this->loginAs()->get($this->pageUrl([
'view' => 'accounts',
'account_category' => 'alipay',
]))->assertOk()->getContent();
$this->assertStringContainsString('账户档案', $alipayHtml);
$this->assertStringContainsString('>支付宝账号</th>', $alipayHtml);
$this->assertStringContainsString('>商户号</th>', $alipayHtml);
$this->assertStringContainsString('保留手动支付宝', $alipayHtml);
$this->assertStringNotContainsString('不保留华夏', $alipayHtml);
$this->assertStringNotContainsString('>开户城市/网点</th>', $alipayHtml);
$bankHtml = $this->loginAs()->get($this->pageUrl([
'view' => 'accounts',
'keep' => 'retained',
'direct' => 'direct',
'account_category' => 'bank',
'bank_group' => '工商银行',
]))->assertOk()->getContent();
$this->assertStringContainsString('>账号</th>', $bankHtml);
$this->assertStringContainsString('>开户行</th>', $bankHtml);
$this->assertStringContainsString('>开户城市/网点</th>', $bankHtml);
$this->assertStringContainsString('>单笔限额</th>', $bankHtml);
$this->assertStringContainsString('>日限额</th>', $bankHtml);
$this->assertStringContainsString('>月限额</th>', $bankHtml);
$this->assertStringContainsString('>年限额</th>', $bankHtml);
$this->assertStringContainsString('>期初余额</th>', $bankHtml);
$this->assertStringContainsString('>当期支出</th>', $bankHtml);
$this->assertStringContainsString('>当期收入</th>', $bankHtml);
$this->assertStringContainsString('>期末余额</th>', $bankHtml);
$this->assertStringContainsString('>操作</th>', $bankHtml);
$this->assertStringContainsString('展示全部', $bankHtml);
$this->assertStringContainsString('50,000.00', $bankHtml);
$this->assertStringContainsString('90,000.00', $bankHtml);
$this->assertStringContainsString('10,000.00', $bankHtml);
$this->assertStringContainsString('20,000.00', $bankHtml);
$this->assertStringContainsString('100,000.00', $bankHtml);
$this->assertStringContainsString('data-ledger-account-edit', $bankHtml);
$this->assertStringContainsString('保留直连工行', $bankHtml);
$this->assertStringContainsString('name="bank_group"', $bankHtml);
$this->assertStringContainsString('<option value="工商银行" selected>', $bankHtml);
$this->assertStringNotContainsString('保留手动支付宝', $bankHtml);
$this->assertStringContainsString('data-column-storage-key="caiwu.non-store-accounts.columns.', $bankHtml);
}
public function test_account_archive_only_contains_retained_accounts(): void
{
$html = $this->loginAs()->get($this->pageUrl([
'view' => 'accounts',
'keep' => 'all',
'account_category' => 'all',
]))->assertOk()->getContent();
$this->assertStringContainsString('保留直连工行', $html);
$this->assertStringContainsString('保留手动支付宝', $html);
$this->assertStringContainsString('data-ledger-add-company', $html);
$this->assertStringContainsString('新增公司/账户', $html);
$this->assertMatchesRegularExpression('/重置.*data-ledger-add-company/s', $html);
$this->assertSame(1, preg_match(
'/<section class="nsm-page-head">.*?<\/section>/s',
$html,
$pageHead,
));
$this->assertStringNotContainsString('data-ledger-add-company', $pageHead[0]);
$this->assertStringNotContainsString('不保留华夏', $html);
$this->assertStringNotContainsString('不保留网商', $html);
$this->assertStringNotContainsString('name="keep"', $html);
}
public function test_account_archive_rolls_period_closing_from_opening_income_and_expense(): void
{
$connection = DB::connection('business_mirror');
$connection->table('fin_daily_flows')
->where('account_short', '保留直连工行')
->where('flow_date', '2026-11-01')
->update(['closing_balance' => 999999]);
$connection->table('fin_daily_flows')->insert([
'flow_date' => '2026-11-02',
'account_short' => '保留直连工行',
'opening_balance' => 555555,
'inflow' => 0,
'outflow' => 5000,
'closing_balance' => 888888,
]);
$twoDayHtml = $this->loginAs()->get($this->pageUrl([
'view' => 'accounts',
'keep' => 'retained',
'account_category' => 'bank',
'period_from' => '2026-11-01',
'period_to' => '2026-11-02',
]))->assertOk()->getContent();
$this->assertStringContainsString('90,000.00', $twoDayHtml);
$this->assertStringContainsString('15,000.00', $twoDayHtml);
$this->assertStringContainsString('20,000.00', $twoDayHtml);
$this->assertStringContainsString('95,000.00', $twoDayHtml);
$firstDayHtml = $this->loginAs()->get($this->pageUrl([
'view' => 'accounts',
'keep' => 'retained',
'account_category' => 'bank',
'period_from' => '2026-11-01',
'period_to' => '2026-11-01',
]))->assertOk()->getContent();
$this->assertStringContainsString('100,000.00', $firstDayHtml);
$this->assertStringNotContainsString('95,000.00', $firstDayHtml);
}
public function test_unretained_tasks_have_a_standalone_processing_page(): void
{
$html = $this->loginAs()->get($this->pageUrl([
'view' => 'unretained_tasks',
]))->assertOk()->getContent();
$this->assertStringContainsString('不保留账户处理进度', $html);
$this->assertStringContainsString('需要处理的账户清单', $html);
$this->assertStringContainsString('不保留华夏', $html);
$this->assertStringContainsString('不保留网商', $html);
$this->assertStringContainsString('财务甲乙', $html);
$this->assertStringContainsString('已完成', $html);
$this->assertStringContainsString('进行中', $html);
$this->assertStringNotContainsString('保留直连工行', $html);
}
public function test_direct_connection_tasks_only_include_retained_bank_accounts(): void
{
$connection = DB::connection('business_mirror');
$connection->table('fin_accounts')->insert([
'company_name' => '保留手动银行公司',
'account_short' => '保留手动招行',
'account_type' => '公户',
'bank_name' => '招商银行上海分行',
'account_no' => '310000000001',
'account_should_keep' => '是',
'current_balance' => 25000,
'daily_available' => 25000,
'blocked_amount' => 0,
'owner' => '李四',
]);
$connection->table('fin_accounts')->insert([
'company_name' => '不纳入直连银行公司',
'account_short' => '保留手动建行',
'account_type' => '公户',
'bank_name' => '中国建设银行上海分行',
'account_no' => '310000000002',
'account_should_keep' => '是',
'current_balance' => 10000,
'daily_available' => 10000,
'blocked_amount' => 0,
'owner' => '王五',
]);
$connection->table('fin_accounts')->insert([
'company_name' => '等待接入中行公司',
'account_short' => '保留手动中行',
'account_type' => '公户',
'bank_name' => '中国银行常州分行',
'account_no' => '320000000001',
'account_should_keep' => '是',
'current_balance' => 5000,
'daily_available' => 5000,
'blocked_amount' => 0,
'owner' => '赵六',
]);
$connection->table('fin_flow_summary_account_sources')->insert([
'account_short' => '保留手动招行',
'data_source' => '手动',
'updated_by' => '测试',
]);
$connection->table('fin_flow_summary_account_sources')->insert([
'account_short' => '保留手动建行',
'data_source' => '手动',
'updated_by' => '测试',
]);
$connection->table('fin_flow_summary_account_sources')->insert([
'account_short' => '保留手动中行',
'data_source' => '手动',
'updated_by' => '测试',
]);
$overviewHtml = $this->loginAs()->get($this->pageUrl())->assertOk()->getContent();
$this->assertStringContainsString('等待接入数量', $overviewHtml);
$this->assertStringContainsString('direct_task_state=non_direct', $overviewHtml);
$html = $this->loginAs()->get($this->pageUrl([
'view' => 'direct_tasks',
]))->assertOk()->getContent();
$this->assertStringContainsString('银企直连处理清单', $html);
$this->assertStringContainsString('华夏银行、中国银行、招商银行', $html);
$this->assertStringNotContainsString('保留直连工行', $html);
$this->assertStringContainsString('保留手动招行', $html);
$this->assertStringContainsString('保留手动中行', $html);
$this->assertStringContainsString('已银企直连', $html);
$this->assertStringContainsString('进度待维护', $html);
$this->assertStringNotContainsString('保留手动建行', $html);
$this->assertStringNotContainsString('保留手动支付宝', $html);
$this->assertStringNotContainsString('不保留华夏', $html);
$this->assertStringNotContainsString('不保留网商', $html);
}
public function test_non_store_account_page_is_available_from_ledger_tabs(): void
{
$this->loginAs();
$reports = collect(\App\Utilities\SidebarMenu::groups($this->user))
->firstWhere('title', '经营报表');
$this->assertNotNull($reports);
$this->assertFalse(collect($reports['items'])->contains(
static fn (array $item): bool => $item['page'] === 'non-store-accounts',
));
$html = $this->loginAs()->get(route('business.pages.show', [
'section' => 'financial-operations',
'page' => 'ledger',
]))->assertOk()->getContent();
$this->assertSame(1, preg_match('/<nav class="ledger-tabbar"[^>]*>(.*?)<\/nav>/s', $html, $tabBar));
$this->assertMatchesRegularExpression(
'/<button[^>]*data-ledger-tab="overview"[^>]*>.*?账户总览.*?<\/button>/s',
$tabBar[1],
);
$this->assertStringContainsString('账户总览', $tabBar[1]);
$this->assertStringNotContainsString('href=', $tabBar[1]);
$this->assertLessThan(
strpos($tabBar[1], 'data-ledger-tab="shops"'),
strpos($tabBar[1], 'data-ledger-tab="overview"'),
);
$overviewHtml = $this->loginAs()->get(route('business.pages.show', [
'section' => 'financial-operations',
'page' => 'ledger',
]) . '?tab=overview')
->assertOk()
->assertSee('data-non-store-monitor', false)
->assertSeeText('账户总览')
->assertSeeText('保留账户')
->getContent();
$this->assertStringContainsString(
'data-current-url="' . e(route('business.pages.show', [
'section' => 'financial-operations',
'page' => 'ledger',
]) . '?tab=overview') . '"',
$overviewHtml,
);
$this->assertStringContainsString('登录已过期,请重新登录后继续操作。', $overviewHtml);
$this->get(route('business.pages.show', [
'section' => 'financial-operations',
'page' => 'ledger',
]) . '?tab=overview&ledger_overview_partial=1')
->assertOk()
->assertSee('id="ledger-panel-overview"', false)
->assertSee('data-non-store-monitor', false)
->assertDontSee('data-ledger-tab="overview"', false);
}
private function pageUrl(array $parameters = []): string
{
return route('business.pages.show', array_merge([
'company_id' => $this->company->id,
'section' => 'financial-operations',
'page' => 'non-store-accounts',
], $parameters));
}
private function dialogHtml(string $html, string $attribute): string
{
$this->assertSame(1, preg_match(
'/<dialog[^>]*\b' . preg_quote($attribute, '/') . '\b[^>]*>.*?<\/dialog>/s',
$html,
$matches,
));
return $matches[0];
}
}