69 lines
3.0 KiB
PHP
69 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\EcommerceFinance;
|
|
|
|
use Tests\Feature\FeatureTestCase;
|
|
|
|
class ExpenseDetailsDrilldownPageTest extends FeatureTestCase
|
|
{
|
|
public function testExpenseDetailsPageRendersCategoryDialogAndCompactColumns(): void
|
|
{
|
|
$this->loginAs()
|
|
->get(route('business.pages.show', [
|
|
'section' => 'financial-operations',
|
|
'page' => 'expense-details',
|
|
]))
|
|
->assertOk()
|
|
->assertSeeText('费用明细')
|
|
->assertSeeText('费用分类汇总')
|
|
->assertSeeText('账单费用')
|
|
->assertSeeText('总金额(万元)')
|
|
->assertSee('/workspace/financial-operations/expense-details/item-summary', false)
|
|
->assertSee('id="pdItemSummary"', false)
|
|
->assertSee('id="pdExpenseCategoryDialog"', false)
|
|
->assertSee('id="pdExpenseCategoryPlatformTab"', false)
|
|
->assertSee('id="pdExpenseCategoryBillTab"', false)
|
|
->assertSee('id="pdExpenseCategoryDialogPlatformRows"', 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__open', $template);
|
|
$this->assertStringContainsString('openCategoryDialog(category)', $template);
|
|
$this->assertStringContainsString('category.platforms', $template);
|
|
$this->assertStringContainsString("setCategoryDialogTab('platform')", $template);
|
|
$this->assertStringContainsString('pd-expense-dialog__table', $template);
|
|
$this->assertSame(1, preg_match(
|
|
'/data-pd-expense-panel="platform".*?<\/section>/s',
|
|
$template,
|
|
$platformPanel,
|
|
));
|
|
$this->assertStringContainsString('<th>平台</th>', $platformPanel[0]);
|
|
$this->assertStringContainsString('开票金额(万)', $platformPanel[0]);
|
|
$this->assertStringContainsString('不开票金额(万)', $platformPanel[0]);
|
|
$this->assertStringContainsString('总金额(万)', $platformPanel[0]);
|
|
$this->assertStringNotContainsString('账单名称', $platformPanel[0]);
|
|
$this->assertStringNotContainsString('pd-item-summary__toggle', $template);
|
|
$this->assertStringNotContainsString('pd-item-summary__drill', $template);
|
|
$this->assertStringContainsString(
|
|
'max-height:clamp(30rem, 70vh, 44rem)',
|
|
$template,
|
|
);
|
|
}
|
|
}
|