44 lines
1.4 KiB
PHP
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);
|
|
}
|
|
}
|