CaiWuXiTong/tests/Feature/Console/DingPayableWorkflowMirrorSyncTest.php

29 lines
1.0 KiB
PHP

<?php
namespace Tests\Feature\Console;
use Mockery;
use Modules\EcommerceFinance\Services\DingPayableWorkflowMirrorSynchronizer;
use Tests\TestCase;
class DingPayableWorkflowMirrorSyncTest extends TestCase
{
public function test_explicit_full_sync_is_forwarded_to_the_workflow_synchronizer(): void
{
config(['upstream_mirrors.refresh_enabled' => false]);
$synchronizer = Mockery::mock(DingPayableWorkflowMirrorSynchronizer::class);
$synchronizer->shouldReceive('sync')->once()->with(true, 25, 1)->andReturn([
'status' => 'succeeded', 'mode' => 'full', 'batches' => 1, 'rows' => 2,
'dataset' => 'operations_replica.rpt.ding_payable_workflows',
]);
$this->app->instance(DingPayableWorkflowMirrorSynchronizer::class, $synchronizer);
$this->artisan('business-mirror:sync-ding-payable-workflows', [
'--full' => true,
'--batch' => 25,
'--max-batches' => 1,
])->expectsOutputToContain('同步完成')
->assertSuccessful();
}
}