CaiWuXiTong/tests/Feature/Business/PromotionMarketingAccountBillsTest.php
qiuxiang 21b4cf58d2 feat: 新增推广费营销账户页签与店铺明细弹窗
在店铺收款账户账单中新增推广费(营销账户)页签和第五个指标卡;点击查看明细可打开店铺明细弹窗,固定展示店铺名称、交易时间、备注和支出金额。补充前后端契约与导航测试,当前取数源保持待接入状态。
2026-10-27 16:42:30 +08:00

62 lines
2.6 KiB
PHP

<?php
namespace Tests\Feature\Business;
use Tests\Feature\FeatureTestCase;
class PromotionMarketingAccountBillsTest extends FeatureTestCase
{
public function test_promotion_marketing_tab_is_next_to_vipshop_jx(): void
{
$pages = collect(config('business_navigation'))
->firstWhere('slug', 'billing-transactions')['pages'];
$tabs = collect($pages)->firstWhere('slug', 'store-receiving-bills')['tabs'];
$slugs = array_column($tabs, 'slug');
$vipshopJxIndex = array_search('vipshop-jx', $slugs, true);
$this->assertNotFalse($vipshopJxIndex);
$this->assertSame('promotion-marketing', $slugs[$vipshopJxIndex + 1] ?? null);
$this->assertSame('推广费(营销账户)', $tabs[$vipshopJxIndex + 1]['title'] ?? null);
$this->loginAs()
->get(route('business.pages.show', [
'section' => 'billing-transactions',
'page' => 'store-receiving-bills',
'tab' => 'promotion-marketing',
]))
->assertOk()
->assertSeeText('推广费(营销账户)');
}
public function test_promotion_marketing_placeholder_keeps_the_detail_contract_stable(): void
{
$this->loginAs()
->getJson(route('ecommerce-finance.account-bills.index', [
'bill_type' => 'promotion-marketing',
]))
->assertOk()
->assertJsonPath('total', 0)
->assertJsonPath('columns.title', '推广费(营销账户)')
->assertJsonPath('columns.columns.0.label', '店铺名称')
->assertJsonPath('columns.columns.1.label', '交易时间')
->assertJsonPath('columns.columns.2.label', '备注')
->assertJsonPath('columns.columns.3.label', '支出金额');
$this->loginAs()
->getJson(route('ecommerce-finance.account-bills.promotion-expense-details', [
'bill_type' => 'promotion-marketing',
'start' => '2026-10-01',
'end' => '2026-10-31',
]))
->assertOk()
->assertJsonPath('total', 0)
->assertJsonPath('summary.expense', 0)
->assertJsonPath('summary.count', 0)
->assertJsonPath('columns.0.field', 'store_name')
->assertJsonPath('columns.1.field', 'occurred_at')
->assertJsonPath('columns.2.field', 'notes')
->assertJsonPath('columns.3.field', 'expense')
->assertJsonPath('message', '推广费数据源尚未配置,接入后将按当前筛选显示店铺明细。');
}
}