CaiWuXiTong/tests/Feature/Console/SyncDingProcessDetailMirrorTest.php
yueyang 6f4883a9ec feat: 钉钉官方接口补取流程付款明细 (#681)
使用官方审批实例接口补取副本缺失的付款明细,并支持定向和自动轮转补取。
2026-10-27 11:56:35 +08:00

52 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Tests\Feature\Console;
use Mockery;
use Modules\EcommerceFinance\Services\DingProcessDetailMirrorSynchronizer;
use Tests\Feature\FeatureTestCase;
class SyncDingProcessDetailMirrorTest extends FeatureTestCase
{
public function test_business_id_option_runs_targeted_dry_run(): void
{
$synchronizer = Mockery::mock(DingProcessDetailMirrorSynchronizer::class);
$synchronizer->shouldReceive('syncBusinessIds')
->once()
->with(
['202610151743000310225', '202610151743000310226'],
true,
)
->andReturn([
'status' => 'validated',
'run_mode' => 'business_ids',
'workflows' => 1,
'details' => 2,
'payments' => 1,
'amount_total' => 15535.37,
'bank_amount_total' => 15535.37,
]);
$this->app->instance(DingProcessDetailMirrorSynchronizer::class, $synchronizer);
$this->artisan('business-mirror:sync-ding-process-details', [
'--business-id' => '202610151743000310225,202610151743000310226',
'--dry-run' => true,
])
->expectsOutputToContain('校验通过:1 个审批,2 条明细,1 笔付款')
->assertSuccessful();
}
public function test_full_and_business_id_cannot_be_combined(): void
{
$synchronizer = Mockery::mock(DingProcessDetailMirrorSynchronizer::class);
$synchronizer->shouldNotReceive('sync');
$synchronizer->shouldNotReceive('syncBusinessIds');
$this->app->instance(DingProcessDetailMirrorSynchronizer::class, $synchronizer);
$this->artisan('business-mirror:sync-ding-process-details', [
'--full' => true,
'--business-id' => '202610151743000310225',
])->assertFailed();
}
}