85 lines
3.6 KiB
PHP
85 lines
3.6 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Business;
|
|
|
|
use Mockery;
|
|
use Modules\EcommerceFinance\Repositories\CostFreightAnomalyRepository;
|
|
use Tests\Feature\FeatureTestCase;
|
|
|
|
class CostFreightAnomalyPageTest extends FeatureTestCase
|
|
{
|
|
public function test_page_renders_cost_freight_anomaly_rows(): void
|
|
{
|
|
$repository = Mockery::mock(CostFreightAnomalyRepository::class);
|
|
$repository->shouldReceive('status')->once()->andReturn([
|
|
'ready' => true,
|
|
'last_synced_at' => '2026-11-07 17:44:20',
|
|
'total' => 1,
|
|
'shops' => ['天猫-卓禾家具旗舰店'],
|
|
'detail_ready' => true,
|
|
'detail_total' => 1,
|
|
'detail_last_synced_at' => '2026-11-09 10:00:00',
|
|
]);
|
|
$repository->shouldReceive('paginate')->once()->andReturn([
|
|
'rows' => [[
|
|
'shop_name' => '天猫-卓禾家具旗舰店',
|
|
'online_order_no' => '5127581702031023636',
|
|
'internal_order_no' => '10097143',
|
|
'order_key' => '天猫-卓禾家具旗舰店|5127581702031023636',
|
|
'ship_time' => '2026-11-05 12:58:35',
|
|
'product_cost' => 0.0,
|
|
'matched_package_fee' => 0.0,
|
|
'matched_freight_fee' => 0.0,
|
|
'matched_bill_fee' => -0.5,
|
|
'synced_at' => '2026-11-07 17:44:20',
|
|
'anomaly_types' => ['成本异常', '运费异常'],
|
|
'anomaly_type' => '成本异常、运费异常',
|
|
'order_fields' => [
|
|
['code' => 'c_900901', 'title' => '店铺名称', 'value' => '天猫-卓禾家具旗舰店'],
|
|
['code' => 'c_900951', 'title' => '发货仓库', 'value' => '简尚-崔桥工厂仓'],
|
|
],
|
|
'missing_cost_barcodes' => ['ZWJ003952N181V01'],
|
|
'detail_synced_at' => '2026-11-09 10:00:00',
|
|
'detail_item_count' => 1,
|
|
'detail_after_item_count' => 0,
|
|
'detail_missing_cost_item_count' => 1,
|
|
'detail_order_headers' => [
|
|
['fld' => 'c_900904', 'title' => '商品编码'],
|
|
['fld' => 'c_900910', 'title' => '商品名称'],
|
|
['fld' => 'c_900201', 'title' => '商品成本'],
|
|
],
|
|
'detail_order_items' => [[
|
|
'c_900904' => 'ZWJ003952N181V01',
|
|
'c_900910' => '支架',
|
|
'c_900201' => 0,
|
|
]],
|
|
'detail_after_headers' => [],
|
|
'detail_after_items' => [],
|
|
]],
|
|
'total' => 1,
|
|
'has_more' => false,
|
|
]);
|
|
$this->app->instance(CostFreightAnomalyRepository::class, $repository);
|
|
|
|
$this->loginAs()->get(route('business.pages.show', [
|
|
'section' => 'fee-ratio-monitoring',
|
|
'page' => 'cost-freight-anomaly',
|
|
'from' => '2026-11-01',
|
|
'to' => '2026-11-07',
|
|
]))
|
|
->assertOk()
|
|
->assertSeeText('成本/运费异常')
|
|
->assertSeeText('商品成本')
|
|
->assertSeeText('快递费(自动匹配)')
|
|
->assertSeeText('5127581702031023636')
|
|
->assertSeeText('成本异常')
|
|
->assertSeeText('运费异常')
|
|
->assertSeeText('缺成本条码')
|
|
->assertSeeText('ZWJ003952N181V01')
|
|
->assertSeeText('完整订单数据')
|
|
->assertSeeText('简尚-崔桥工厂仓')
|
|
->assertSeeText('销售商品明细')
|
|
->assertSeeText('最近同步');
|
|
}
|
|
}
|