CaiWuXiTong/tests/Feature/EcommerceFinance/ExpenseDetailsDrilldownPageTest.php

48 lines
1.7 KiB
PHP

<?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);
$this->assertStringContainsString(
'max-height:clamp(24rem, 58vh, 32rem)',
$template,
);
}
}