public function testPurgeImageAliasForObject() { $imageObject = $this->createImage("Original image"); // generate a couple aliases $dataMap = $imageObject->dataMap(); $aliasHandler = $dataMap['image']->attribute('content'); foreach (array('small', 'medium', 'large') as $aliasName) { $alias = $aliasHandler->attribute($aliasName); $aliasFiles[] = $alias['url']; } // create a new version $imageObject = $this->createNewVersionWithImage($imageObject); // generate a couple aliases $dataMap = $imageObject->dataMap(); $imageAttribute = $dataMap['image']; $imageAttributeId = $imageAttribute->attribute('id'); $aliasHandler = $imageAttribute->attribute('content'); $aliasFiles = array(); foreach (array('small', 'medium', 'large') as $aliasName) { $alias = $aliasHandler->attribute($aliasName); $aliasFiles[] = $alias['url']; } // we will check that the original alias wasn't removed $originalAlias = $aliasHandler->attribute('original'); $originalAliasFile = $originalAlias['url']; unset($originalAlias); $aliasFiles = array_unique($aliasFiles); foreach ($aliasFiles as $aliasFile) { self::assertImageFileExists($imageAttributeId, $aliasFile); } self::assertImageFileExists($imageAttributeId, $originalAliasFile); eZCache::purgeImageAlias(array('reporter' => function () { })); foreach ($aliasFiles as $aliasFile) { self::assertImageFileNotExists($imageAttributeId, $aliasFile); } self::assertImageFileExists($imageAttributeId, $originalAliasFile); }