CaiWuXiTong/tests/Unit/CourierQuoteDocumentTest.php

23 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Tests\Unit;
use App\Support\CourierQuoteDocument;
use PHPUnit\Framework\TestCase;
class CourierQuoteDocumentTest extends TestCase
{
public function test_only_the_current_quote_execution_clause_is_replaced_and_other_dates_and_rules_survive(): void
{
$label = '2026-10-20 至 2026-10-24;2026-11-11 至 2026-11-14(临时)';
foreach (['此价格于2026年9月20日起', '本价格2026.9.20开始执行', '执行日期:2026-09-20',
'本报价执行期间:2026-10-20 至 2026-10-24;2026-11-11 至 2026-11-14(临时)。'] as $old) {
$text = "7、{$old} 8、以下城市主发\n协议签署日期:2026-09-20\n原报价 QB-108(2026-09-20 起执行)";
$actual = CourierQuoteDocument::executionText($text, $label);
$this->assertSame("7、本报价执行期间:{$label}。 8、以下城市主发\n协议签署日期:2026-09-20\n原报价 QB-108(2026-09-20 起执行)", $actual);
$this->assertSame($actual, CourierQuoteDocument::executionText($actual, $label));
}
$this->assertSame('本报价执行期间:2026-12-01 起。', CourierQuoteDocument::executionText('生效时间:2026/9/20起', '2026-12-01 起'));
}
}