CaiWuXiTong/tests/Unit/EcommerceFinance/BillPerformanceResyncDispatcherTest.php
qiuxiang 37b9a17b65 修复原始账单更新后自动重算业绩明细
京东、京喜、抖音原始账单导入后自动排队重算业绩明细;补齐 10 月最新数据。
2026-11-26 11:53:47 +08:00

44 lines
1.4 KiB
PHP

<?php
namespace Tests\Unit\EcommerceFinance;
use Mockery;
use Modules\EcommerceFinance\Services\AccountMappingResyncDispatcher;
use Modules\EcommerceFinance\Services\BillPerformanceResyncDispatcher;
use Tests\TestCase;
class BillPerformanceResyncDispatcherTest extends TestCase
{
public function test_every_supported_receipt_source_has_a_performance_platform_label(): void
{
$this->assertSame([
'taobao-alipay' => '淘系支付宝',
'taobao-wechat' => '淘系微信',
'pinduoduo' => '拼多多',
'dewu' => '得物',
'jd-transactions' => '京东账单',
'jingxi' => '京喜账单',
'douyin' => '抖音',
], BillPerformanceResyncDispatcher::PLATFORM_LABELS);
}
public function test_it_queues_every_month_covered_by_an_imported_period(): void
{
$queue = Mockery::mock(AccountMappingResyncDispatcher::class);
$queue->shouldReceive('dispatchPlatformMonths')
->once()
->with([
'taobao-wechat' => ['2026-10', '2026-11'],
])
->andReturn(['jobs' => 2]);
$result = (new BillPerformanceResyncDispatcher($queue))
->dispatch('taobao-wechat', '2026-10-29', '2026-11-02');
$this->assertSame([
'jobs' => 2,
'months' => ['2026-10', '2026-11'],
], $result);
}
}