52 lines
1.8 KiB
PHP
52 lines
1.8 KiB
PHP
<?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();
|
||
}
|
||
}
|