89 lines
3.6 KiB
PHP
89 lines
3.6 KiB
PHP
<?php
|
||
|
||
namespace Tests\Feature\Business;
|
||
|
||
use Mockery;
|
||
use Modules\EcommerceFinance\Repositories\InternalFlowReportRepository;
|
||
use Tests\Feature\FeatureTestCase;
|
||
|
||
class InternalFlowReportPageTest extends FeatureTestCase
|
||
{
|
||
public function testInternalFlowReportPageRendersRowsWithQueryAndExportTools(): void
|
||
{
|
||
$repository = Mockery::mock(InternalFlowReportRepository::class);
|
||
$repository->shouldReceive('ready')->once()->andReturn(true);
|
||
$repository->shouldReceive('paginate')->once()->andReturn([
|
||
'data' => [[
|
||
'id' => 1,
|
||
'sort_order' => 1,
|
||
'company_name' => '示例甲供应链有限公司',
|
||
'tag' => '1',
|
||
'projected_sales' => '1200000.000000',
|
||
'invoiced_to_buyer' => '0.000000',
|
||
'internal_invoiced' => '1200000.000000',
|
||
'required_input_cost' => '0.000000',
|
||
'receipt_from_supplier' => null,
|
||
'receipt_from_suofeiya' => null,
|
||
'receipt_from_gujia' => null,
|
||
'internal_transfer_1' => '0.000000',
|
||
'internal_transfer_2' => '0.000000',
|
||
'internal_transfer_3' => '0.000000',
|
||
'receipt_total' => '0.000000',
|
||
'remaining_gap' => '0.000000',
|
||
'invoicing_ratio' => '1',
|
||
]],
|
||
'total' => 1,
|
||
'summary' => [
|
||
'companies' => 1,
|
||
'projected_sales' => 1200000.0,
|
||
'receipt_total' => 0.0,
|
||
'remaining_gap' => 0.0,
|
||
'average_invoicing_ratio' => 100.0,
|
||
],
|
||
]);
|
||
$this->app->instance(InternalFlowReportRepository::class, $repository);
|
||
|
||
$this->loginAs()
|
||
->get(route('business.pages.show', [
|
||
'section' => 'store-management',
|
||
'page' => 'internal-flow-report',
|
||
]))
|
||
->assertOk()
|
||
->assertSeeText('内部流转报表')
|
||
->assertSeeText('按抬头、标签查询内部流转明细并导出')
|
||
->assertSeeText('示例甲供应链有限公司')
|
||
->assertSeeText('预计9月销量')
|
||
->assertSeeText('收票-内部流转(来源)1')
|
||
->assertSeeText('剩余缺口')
|
||
->assertSeeText('开票比例')
|
||
->assertSeeText('公司数')
|
||
->assertSeeText('预计销量合计')
|
||
->assertSeeText('已收票合计')
|
||
->assertSeeText('剩余缺口合计')
|
||
->assertSeeText('平均开票比例')
|
||
->assertSee('data-directory-query-picker', false)
|
||
->assertSee('data-directory-query-export', false)
|
||
->assertSee('data-directory-query-field="company_name"', false)
|
||
->assertSee('data-directory-query-select="tag"', false)
|
||
->assertSeeText('筛选字段')
|
||
->assertSeeText('导出 Excel')
|
||
->assertSee('排序和字段操作', false)
|
||
->assertSee('sort=projected_sales', false);
|
||
}
|
||
|
||
public function testInternalFlowReportPageExplainsMissingDataset(): void
|
||
{
|
||
$repository = Mockery::mock(InternalFlowReportRepository::class);
|
||
$repository->shouldReceive('ready')->once()->andReturn(false);
|
||
$this->app->instance(InternalFlowReportRepository::class, $repository);
|
||
|
||
$this->loginAs()
|
||
->get(route('business.pages.show', [
|
||
'section' => 'store-management',
|
||
'page' => 'internal-flow-report',
|
||
]))
|
||
->assertOk()
|
||
->assertSeeText('内部流转数据尚未导入');
|
||
}
|
||
}
|