CaiWuXiTong/tests/Unit/View/AccountBillsTableTest.php
qiuxiang 3be1639fb2 feat: 推广费营销账户明细汇总
新增推广费(营销账户)页签、平台与原始店铺汇总、备注筛选和明细弹窗。
2026-10-27 19:27:41 +08:00

80 lines
5.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','promotion-marketing'].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('>平台汇总</button>', $source);
$this->assertStringContainsString('>店铺明细</button>', $source);
$this->assertStringContainsString('aria-label="筛选平台"', $source);
$this->assertStringContainsString('aria-label="筛选店铺名称"', $source);
$this->assertStringContainsString('aria-label="筛选备注"', $source);
$this->assertStringContainsString('<th scope="col">平台</th>', $source);
$this->assertStringContainsString('<th scope="col">店铺名称</th>', $source);
$this->assertStringContainsString('<th scope="col" class="is-number">推广费金额(万元)</th>', $source);
$this->assertStringContainsString('promotionFilteredPlatformRows', $source);
$this->assertStringContainsString('promotionFilteredStoreRows', $source);
$this->assertStringContainsString('tw-stats--promotion-only', $source);
$this->assertStringContainsString('.tw-stats--promotion-only{grid-template-columns:minmax(0,1fr)}', $source);
$this->assertStringContainsString('class="tw-date-icon"', $source);
$this->assertStringContainsString("if(this.isPromotionMarketing){\n return [{label:'推广费(营销账户)'", $source);
}
}