public function testProxyCallToCacheManagerOnFilter() { $expectedPath = 'thePathToTheImage'; $expectedFilter = 'thumbnail'; $expectedCachePath = 'thePathToTheCachedImage'; $cacheManager = $this->createCacheManagerMock(); $cacheManager->expects($this->once())->method('getBrowserPath')->with($expectedPath, $expectedFilter)->will($this->returnValue($expectedCachePath)); $extension = new ImagineExtension($cacheManager); $this->assertEquals($expectedCachePath, $extension->filter($expectedPath, $expectedFilter)); }
private function normalizeImages() { if (empty($this->images)) { return; } foreach ($this->images as $imageKey => $image) { if (!array_key_exists($imageKey, $this->normalizedEntity)) { throw new Exception('This image field not exists!'); } if (!empty($this->normalizedEntity[$imageKey])) { $filteredImage = $this->imagine->filter($this->normalizedEntity[$imageKey], $image['filter']); $this->normalizedEntity[$imageKey] = '<a href="' . $filteredImage . '" target="_blank"><img src="' . $filteredImage . '"/></a>'; } else { $this->normalizedEntity[$imageKey] = '-'; } } }