70 lines
3.1 KiB
PHP
70 lines
3.1 KiB
PHP
<?php
|
||
|
||
namespace Tests\Feature\Business;
|
||
|
||
use App\Models\Auth\Permission;
|
||
use Mockery;
|
||
use Modules\EcommerceFinance\Repositories\DingPayableWorkflowMirrorRepository;
|
||
use Tests\Feature\FeatureTestCase;
|
||
|
||
class DingPayableWorkflowPageTest extends FeatureTestCase
|
||
{
|
||
public function test_cloud_warehouse_vehicle_fee_page_renders_all_workflow_sections(): void
|
||
{
|
||
$this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail());
|
||
$repository = Mockery::mock(DingPayableWorkflowMirrorRepository::class);
|
||
$repository->shouldReceive('paginate')->once()->andReturn([
|
||
'data' => [[
|
||
'process_instance_id' => 'PROC-TEST-001',
|
||
'workflow' => [
|
||
'businessId' => '202607031324000376786',
|
||
'title' => '应付申请流程',
|
||
'status' => 'COMPLETED',
|
||
'originatorUserId' => 'user-1',
|
||
'originatorUserName' => '扬灵',
|
||
'originatorDeptName' => '财务部',
|
||
'createAt' => '2026-08-28 10:00:00',
|
||
'finishTime' => '2026-08-28 11:00:00',
|
||
],
|
||
'detail' => ['类型' => '快递运费', '用途' => '拉到江西仓的车费', '付款金额' => '1200'],
|
||
'fields' => ['应付明细' => [], '付款明细' => [['付款金额' => '1200']], '附件' => []],
|
||
'tasks' => [['status' => 'COMPLETED']],
|
||
]],
|
||
'total' => 1,
|
||
'status' => 'succeeded',
|
||
'last_synced_at' => '2026-08-28 11:05:00',
|
||
]);
|
||
$this->app->instance(DingPayableWorkflowMirrorRepository::class, $repository);
|
||
|
||
$this->loginAs()->get(route('business.pages.show', [
|
||
'section' => 'courier-payables',
|
||
'page' => 'payable-cloud-warehouse-vehicle-fee',
|
||
]))->assertOk()
|
||
->assertSee('应付云仓车费')
|
||
->assertSee('钉钉审批编号')
|
||
->assertSee('202607031324000376786')
|
||
->assertSee('扬灵')
|
||
->assertSee('已完成')
|
||
->assertSee('拉到江西仓的车费')
|
||
->assertSee('用途同时包含“仓”“车费”')
|
||
->assertSee('全部表单字段')
|
||
->assertSee('审批任务')
|
||
->assertSee('镜像状态:succeeded');
|
||
}
|
||
|
||
public function test_cloud_warehouse_vehicle_fee_page_keeps_an_unavailable_mirror_readable(): void
|
||
{
|
||
$this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail());
|
||
$repository = Mockery::mock(DingPayableWorkflowMirrorRepository::class);
|
||
$repository->shouldReceive('paginate')->andThrow(new \RuntimeException('not ready'));
|
||
$this->app->instance(DingPayableWorkflowMirrorRepository::class, $repository);
|
||
|
||
$this->loginAs()->get(route('business.pages.show', [
|
||
'section' => 'courier-payables',
|
||
'page' => 'payable-cloud-warehouse-vehicle-fee',
|
||
]))->assertOk()
|
||
->assertSee('钉钉应付流程镜像尚未完成同步,请稍后重试。')
|
||
->assertSee('镜像读取失败,请稍后重试。');
|
||
}
|
||
}
|