/** * Validates a cache ID. * * @SuppressWarnings(PHPMD.UnusedLocalVariable) * * @throws \Exception Throws if the cacheId and a bundle name are duplicated. */ protected function validateCacheId() { foreach ($this->container->getParameter('kernel.bundles') as $className => $fqcn) { $id = ServiceIdBuilder::parseServiceId($className); $serviceIdPrefix = $this->idBuilder->getPrefix(); if ($serviceIdPrefix === $id) { throw new \Exception("Cache ID[{$serviceIdPrefix}] and Service ID[{$id}] " . "based Bundle name[{$className}] are duplicated"); } } }
/** * @dataProvider parseServiceIdProvider */ public function testParseServiceId($name, $expected) { $this->assertSame($expected, ServiceIdBuilder::parseServiceId($name)); }