54 lines
2.0 KiB
PHP
54 lines
2.0 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' => ['天猫-卓禾家具旗舰店'],
|
|
]);
|
|
$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_type' => '商品成本及快递费缺失',
|
|
]],
|
|
'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('最近同步');
|
|
}
|
|
}
|