mirror of
https://gitee.com/ShopeX/ECShopX
synced 2026-08-08 12:55:32 +08:00
4.6.0
This commit is contained in:
31
tests/EmployeePurchaseCartLimitFieldsStructureTest.php
Normal file
31
tests/EmployeePurchaseCartLimitFieldsStructureTest.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 内购购物车列表透出限购与聚合字段(与 EmployeePurchaseItemLimitValidator 数据源一致)。
|
||||
*/
|
||||
|
||||
use EmployeePurchaseBundle\Services\CartService;
|
||||
|
||||
class EmployeePurchaseCartLimitFieldsStructureTest 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 testGetCartdataListBatchLoadsMemberAggregate(): void
|
||||
{
|
||||
$body = $this->methodBody(CartService::class, 'getCartdataList');
|
||||
$this->assertStringContainsString('MemberActivityItemsAggregateService', $body);
|
||||
$this->assertStringContainsString('getLists', $body);
|
||||
$this->assertStringContainsString("'aggregate_num'", $body);
|
||||
$this->assertStringContainsString("'limit_num'", $body);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user