public function testCachingConfigurations() { $kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->getMock(); $kernelMock->method('getBundles')->willReturn([new EnhavoSearchBundle()]); $filesystemMock = $this->getMockBuilder('Enhavo\\Bundle\\AppBundle\\Filesystem\\Filesystem')->getMock(); $filesystemMock->expects($this->once())->method('readFile')->willReturn("ResourceEntity1:\n type: myType\n option: Option\nResourceEntity2:\n type: myType\n"); $metadataCollector = new MetadataCollector($kernelMock, $filesystemMock); $metadataCollector->getConfigurations(); $metadataCollector->getConfigurations(); }
public function testCachingConfigurations() { $kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->getMock(); $kernelMock->method('getBundles')->willReturn([new EnhavoSearchBundle($kernelMock)]); $filesystemMock = $this->getMockBuilder('Enhavo\\Bundle\\AppBundle\\Filesystem\\Filesystem')->getMock(); $filesystemMock->expects($this->once())->method('readFile')->willReturn(json_encode(['ResourceEntity1' => ['type' => 'myType', 'option' => 'Option'], 'ResourceEntity2' => ['type' => 'myType']])); $metadataCollector = new MetadataCollector($kernelMock, $filesystemMock); $metadataCollector->getConfigurations(); $metadataCollector->getConfigurations(); }
protected function getConfiguration($className) { $configurations = $this->collector->getConfigurations(); if (isset($configurations[$className])) { return $configurations[$className]; } else { if ($className == 'Doctrine\\ORM\\PersistentCollection') { } } return null; }