CaiWuXiTong/tests/Feature/Business/ProductCostPageLayoutTest.php
chenxi fcd54a8080 商品成本:精简成本指标卡
移除商品成本页面四个指标卡,保留成本合计、待核验与仓库异常指标,其余逻辑不变。
2026-10-25 16:37:40 +08:00

74 lines
3.3 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('商品成本合计', $html);
$this->assertStringContainsString('待核验成本', $html);
$this->assertStringContainsString('待核验商品数量', $html);
$this->assertStringContainsString('未匹配仓库简称', $html);
$this->assertStringNotContainsString('明细行数', $html);
$this->assertStringNotContainsString('已计价商品数量', $html);
$this->assertStringNotContainsString('线上代发价兜底', $html);
$this->assertStringNotContainsString('商品资料成本兜底', $html);
$this->assertStringContainsString('class="product-cost-filter-form"', $html);
$this->assertStringContainsString('搜索当前页数据', $html);
$this->assertStringContainsString('列设置', $html);
$this->assertStringContainsString('全部筛选结果', $html);
$this->assertStringContainsString('当前显示列及顺序', $html);
$this->assertStringContainsString('id="product-cost-table"', $html);
$this->assertStringContainsString('导出当前筛选结果', $html);
}
}