Files
ECShopX/tests/ApiGetUserCardListFastBuyStructureTest.php
wanghai 058673559c 4.7.0
2026-06-26 19:20:24 +08:00

36 lines
1.2 KiB
PHP
Raw Permalink 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
/**
* 店务 getUserCardList立即购买须读 Redis fastbuy 分桶,与 checkout 一致。
*/
use KaquanBundle\Http\Api\V1\Action\UserDiscount;
class ApiGetUserCardListFastBuyStructureTest extends TestCase
{
private function methodBody(string $class, string $method): string
{
$ref = new ReflectionMethod($class, $method);
$file = $ref->getFileName();
$this->assertNotFalse($file);
$lines = file($file, FILE_IGNORE_NEW_LINES);
$this->assertIsArray($lines);
$slice = array_slice($lines, $ref->getStartLine() - 1, $ref->getEndLine() - $ref->getStartLine() + 1);
return implode("\n", $slice);
}
public function testGetUserCardListFastBuyUsesRedisBucketPath(): void
{
$body = $this->methodBody(UserDiscount::class, 'getUserCardList');
$this->assertStringContainsString('getFastBuyCartdataList', $body);
$this->assertStringContainsString('fastbuy', $body);
}
public function testGetUserCardListCartModeStillUsesOperatorCartList(): void
{
$body = $this->methodBody(UserDiscount::class, 'getUserCardList');
$this->assertStringContainsString('getCartdataList', $body);
}
}