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); } /** * TC-COEX-01 / S16:立即购买路径不持久化到 OperatorCart 表(与普通行互不影响的一侧保证)。 */ public function testTcCoex01FastBuyDoesNotUseEntityRepository(): void { $body = $this->methodBody(OperatorCartService::class, 'addFastBuyCartdata'); $this->assertStringNotContainsString('entityRepository', $body); } /** * TC-COEX-02 / S17:普通 cartDataAdd 不读写店务立即购买 Redis 分桶。 */ public function testTcCoex02CartDataAddDoesNotTouchShopFastBuyRedis(): void { $body = $this->methodBody(OperatorCartService::class, 'addCartdata'); $this->assertStringNotContainsString('OperatorShopFastBuyRedisService', $body); $this->assertStringNotContainsString('shop_fastbuy', $body); } /** * TC-REG-01 / S15:普通加车仍走 _checkAddCartItems(门店 store 校验保留在重构后路径上)。 */ public function testTcReg01AddCartdataStillUsesCheckAddCartItems(): void { $body = $this->methodBody(OperatorCartService::class, 'addCartdata'); $this->assertStringContainsString('_checkAddCartItems', $body); } }