test: 隔离费用明细页面验收

This commit is contained in:
yueyang 2026-10-24 19:37:28 +08:00
parent 4053d51007
commit 58d257ab0e
2 changed files with 43 additions and 18 deletions

View File

@ -0,0 +1,43 @@
<?php
namespace Tests\Feature\EcommerceFinance;
use Tests\Feature\FeatureTestCase;
class ExpenseDetailsDrilldownPageTest extends FeatureTestCase
{
public function testExpenseDetailsPageRendersCategoryDrilldownAndCompactColumns(): void
{
$this->loginAs()
->get(route('business.pages.show', [
'section' => 'financial-operations',
'page' => 'expense-details',
]))
->assertOk()
->assertSeeText('费用明细')
->assertSeeText('费用分类汇总')
->assertSee('/workspace/financial-operations/expense-details/item-summary', false)
->assertSee('id="pdItemSummary"', false)
->assertDontSee('data-col="record_code"', false)
->assertDontSee('data-col="bill_item"', false);
$template = (string) file_get_contents(resource_path(
'views/business/pages/financial-operations/billing-details.blade.php',
));
$this->assertSame(1, preg_match(
'/<table class="pd-table">\s*<thead>\s*<tr>\s*@if \(\$expenseOnly\)(.*?)@else/s',
$template,
$expenseHeader,
));
preg_match_all('/data-col="([^"]+)"/', $expenseHeader[1], $columns);
$this->assertSame([
'platform',
'store_name',
'online_order_no',
'finance_remark',
'amount',
], $columns[1]);
$this->assertStringContainsString('pd-item-summary__toggle', $template);
$this->assertStringContainsString('category.items', $template);
}
}

View File

@ -151,25 +151,7 @@ class NavigationTest extends FeatureTestCase
->assertSeeText('不开票金额(万)')
->assertDontSee('<div class="pd-stats">', false)
->assertDontSee('data-col="record_code"', false)
->assertDontSee('data-col="bill_item"', false)
->assertDontSee('id="pdType"', false);
$template = (string) file_get_contents(resource_path(
'views/business/pages/financial-operations/billing-details.blade.php',
));
$this->assertSame(1, preg_match(
'/<table class="pd-table">\s*<thead>\s*<tr>\s*@if \(\$expenseOnly\)(.*?)@else/s',
$template,
$expenseHeader,
));
preg_match_all('/data-col="([^"]+)"/', $expenseHeader[1], $columns);
$this->assertSame([
'platform',
'store_name',
'online_order_no',
'finance_remark',
'amount',
], $columns[1]);
}
public function testFinancialAnalysisPageIncludesInvoiceExpenseColumns(): void