映射表保存、删除、恢复、导入和重置后,自动把受影响平台已存在的月份排入后台队列;后台按平台×月份逐个独立进程重跑,数据库锁防重复,生产 cron 每分钟兜底。保存响应直接提示排队任务数。
34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\EcommerceFinance;
|
|
|
|
use Modules\EcommerceFinance\Services\AccountMappingResyncDispatcher;
|
|
use ReflectionClass;
|
|
use Tests\TestCase;
|
|
|
|
class AccountMappingResyncDispatcherTest extends TestCase
|
|
{
|
|
public function test_all_taobao_family_platforms_trigger_the_matching_receipt_sources(): void
|
|
{
|
|
$reflection = new ReflectionClass(AccountMappingResyncDispatcher::class);
|
|
$map = $reflection->getConstant('PLATFORM_MAP');
|
|
|
|
$this->assertSame(
|
|
[['taobao-alipay', '淘系支付宝'], ['taobao-wechat', '淘系微信']],
|
|
$map['淘宝']
|
|
);
|
|
$this->assertSame(
|
|
[['taobao-alipay', '淘系支付宝'], ['taobao-wechat', '淘系微信']],
|
|
$map['天猫']
|
|
);
|
|
$this->assertSame([['taobao-alipay', '淘系支付宝']], $map['阿里巴巴']);
|
|
}
|
|
|
|
public function test_platform_without_receipt_sync_is_a_noop(): void
|
|
{
|
|
$result = app(AccountMappingResyncDispatcher::class)->dispatchFor(['唯品会JX']);
|
|
|
|
$this->assertSame(['jobs' => 0], $result);
|
|
}
|
|
}
|