45 lines
1.8 KiB
PHP
45 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\EcommerceFinance;
|
|
|
|
use Modules\EcommerceFinance\Repositories\DewuSettlementBillRepository;
|
|
use Modules\EcommerceFinance\Repositories\StoreReceivingDewuBillMirrorRepository;
|
|
use Tests\TestCase;
|
|
|
|
class StoreReceivingDewuBillMirrorRepositoryTest extends TestCase
|
|
{
|
|
public function test_it_delegates_page_reads_to_the_authoritative_dewu_repository(): void
|
|
{
|
|
$filters = ['store_name' => '得物-测试店', 'start' => '2026-09-01', 'end' => '2026-09-30'];
|
|
$page = [
|
|
'data' => [['record_code' => '200000000000000001']],
|
|
'total' => 1,
|
|
'current_page' => 1,
|
|
'last_page' => 1,
|
|
'per_page' => 20,
|
|
'summary' => ['income' => 21.00, 'expense' => 0.00, 'balance' => 21.00, 'count' => 1],
|
|
];
|
|
$export = [['record_code' => '200000000000000001']];
|
|
$options = ['shops' => ['得物-测试店'], 'bill_items' => ['交易收入']];
|
|
|
|
$source = $this->createMock(DewuSettlementBillRepository::class);
|
|
$source->expects($this->once())
|
|
->method('paginateAccountBills')
|
|
->with($filters, 'occurred_at', 'desc', 1, 20)
|
|
->willReturn($page);
|
|
$source->expects($this->once())
|
|
->method('exportAccountBills')
|
|
->with($filters, 'occurred_at', 'asc')
|
|
->willReturn($export);
|
|
$source->expects($this->once())
|
|
->method('accountBillFilterOptions')
|
|
->willReturn($options);
|
|
|
|
$repository = new StoreReceivingDewuBillMirrorRepository($source);
|
|
|
|
$this->assertSame($page, $repository->paginate($filters, 'occurred_at', 'desc', 1, 20));
|
|
$this->assertSame($export, $repository->exportRows($filters, 'occurred_at', 'asc'));
|
|
$this->assertSame($options, $repository->filterOptions());
|
|
}
|
|
}
|