mirror of
https://gitee.com/ShopeX/ECShopX
synced 2026-08-04 11:16:23 +08:00
4.7.0
This commit is contained in:
35
tests/ApiGetUserCardListFastBuyStructureTest.php
Normal file
35
tests/ApiGetUserCardListFastBuyStructureTest.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user