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

70 lines
4.4 KiB
PHP

<?php
namespace Tests\Unit\View;
use PHPUnit\Framework\TestCase;
class AccountBillsTableTest extends TestCase
{
public function test_authoritative_bill_pages_use_stable_date_controls_and_existing_table_interactions(): void
{
$source = file_get_contents(__DIR__ . '/../../../resources/assets/js/components/business/AccountBills.vue');
$this->assertStringContainsString("isDouyin(){return this.billType==='douyin';}", $source);
$this->assertStringContainsString("usesStableDateControl(){return true;}", $source);
$this->assertStringContainsString("{ 'is-stable-date': usesStableDateControl }", $source);
$this->assertStringContainsString('.tw-date.is-stable-date .tw-date-control', $source);
$this->assertStringContainsString("['douyin','pinduoduo','dewu','taobao-wechat','jd-transactions','jingxi','jd-wallet','vipshop','vipshop-jx'].indexOf(this.billType)!==-1", $source);
$this->assertStringContainsString('v-if="usesMirrorOptions && !filterOptionsError"', $source);
$this->assertStringContainsString('page-key="store-receiving-bills"', $source);
$this->assertStringContainsString(':tab-key="billType"', $source);
$this->assertStringContainsString("value=\"page-visible\"", $source);
$this->assertStringContainsString("value=\"filtered-visible\"", $source);
$this->assertStringContainsString("value=\"filtered-all\"", $source);
$this->assertStringContainsString('position:sticky', $source);
$this->assertStringContainsString('overflow:auto', $source);
}
public function test_store_receiving_tabs_route_the_vipshop_jx_account(): void
{
$source = file_get_contents(__DIR__ . '/../../../resources/assets/js/views/business/pages.js');
$this->assertStringContainsString(
"const GENERIC_TABS = ['taobao-wechat', 'pinduoduo', 'jd-wallet', 'jd-transactions', 'jingxi', 'douyin', 'dewu', 'vipshop', 'vipshop-jx', 'promotion-marketing'];",
$source,
);
$this->assertStringContainsString(
"const STORE_RECEIVING_TABS = ['taobao-alipay', 'taobao-wechat', 'pinduoduo', 'jd-wallet', 'jd-transactions', 'jingxi', 'douyin', 'dewu', 'vipshop', 'vipshop-jx', 'promotion-marketing'];",
$source,
);
}
public function test_jd_and_jingxi_tabs_share_the_same_date_and_summary_behaviour(): void
{
$source = file_get_contents(__DIR__ . '/../../../resources/assets/js/components/business/AccountBills.vue');
$this->assertStringContainsString("const JD_BILL_TABS = ['jd-transactions','jingxi'];", $source);
$this->assertStringContainsString("isJdBillTab(){return JD_BILL_TABS.indexOf(this.billType)!==-1;}", $source);
// 唯品会两个页签的筛选标签是「账单期间」(后端也只按 payload.settle_period 过滤)。
$this->assertStringContainsString("const DATE_FILTER_LABELS = {'jd-transactions':'费用结算时间','jingxi':'费用结算时间','jd-wallet':'费用结算时间','douyin':'结算时间','vipshop':'账单期间','vipshop-jx':'账单期间','promotion-marketing':'交易时间'};", $source);
$this->assertStringContainsString('{{ dateFilterLabel }}', $source);
$this->assertStringContainsString('v-if="isJdBillTab && sync"', $source);
$this->assertStringContainsString("netLabel=JD_BILL_TABS.concat(['vipshop-jx']).indexOf(this.billType)!==-1", $source);
}
public function test_promotion_marketing_card_opens_the_store_detail_modal(): void
{
$source = file_get_contents(__DIR__ . '/../../../resources/assets/js/components/business/AccountBills.vue');
$this->assertStringContainsString('推广费(营销账户)', $source);
$this->assertStringContainsString("label:'推广费(营销账户)'", $source);
$this->assertStringContainsString('查看明细 →', $source);
$this->assertStringContainsString('aria-labelledby="promotion-expense-detail-title"', $source);
$this->assertStringContainsString('<strong id="promotion-expense-detail-title">店铺明细</strong>', $source);
$this->assertStringContainsString("label:'店铺名称',field:'store_name'", $source);
$this->assertStringContainsString("label:'交易时间',field:'occurred_at'", $source);
$this->assertStringContainsString("label:'备注',field:'notes'", $source);
$this->assertStringContainsString("label:'支出金额',field:'expense'", $source);
}
}