CaiWuXiTong/tests/Feature/Business/ProductCostPageLayoutTest.php
chenxi 2edb87c6d0 商品成本:优化为业绩明细式页面布局
统一商品成本的标题面板、共享镜像状态、成本指标卡、横向筛选、口径说明和明细面板;查询与成本口径保持不变。
2026-10-25 15:53:11 +08:00

62 lines
2.4 KiB
PHP

<?php
namespace Tests\Feature\Business;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\URL;
use Tests\TestCase;
class ProductCostPageLayoutTest extends TestCase
{
public function test_product_cost_page_uses_performance_detail_style_modules(): void
{
URL::defaults(['company_id' => 1]);
$row = (object) [
'occurred_date' => '2026-09-01',
'store_name' => '测试店铺',
'online_order_no' => 'ORDER-1',
'warehouse' => '简尚-崔桥工厂仓',
'warehouse_short_name' => '崔桥工厂仓',
'product_code' => 'SKU-1',
'product_quantity' => 1,
'unit_price' => 10,
'product_cost' => 10,
];
$html = view('business.pages.financial-operations.product-costs', [
'section' => ['slug' => 'financial-operations'],
'page' => ['slug' => 'product-costs'],
'productCostRows' => new LengthAwarePaginator([$row], 1, 25, 1, ['path' => '/product-costs']),
'productCostFilters' => [
'month' => '2026-09',
'platform' => '',
'store_name' => '',
'online_order_no' => '',
'product_code' => '',
'warehouse_short_name' => '',
],
'productCostSummary' => [
'rows' => 1,
'quantity_total' => 1,
'cost_total' => 10,
'pending_cost_rows' => 0,
'pending_cost_quantity' => 0,
'fallback_price_rows' => 0,
'catalog_price_rows' => 0,
'missing_warehouse_rows' => 0,
],
'productCostMonths' => ['2026-09'],
'productCostPlatforms' => ['抖音'],
'productCostWarehouses' => ['崔桥工厂仓'],
'productCostError' => null,
])->render();
$this->assertStringContainsString('product-cost-head', $html);
$this->assertStringContainsString('共享镜像', $html);
$this->assertStringContainsString('成本指标', $html);
$this->assertStringContainsString('口径说明', $html);
$this->assertStringContainsString('class="product-cost-filter-form"', $html);
$this->assertStringContainsString('id="product-cost-table"', $html);
$this->assertStringContainsString('导出当前筛选结果', $html);
}
}