public function testSkipDefaultIcon()
 {
     $fetcher = new GetFaviconFetcher();
     $destination = __DIR__ . '/../Resources/bogus_getfavicon_favicon.ico';
     $generated = $fetcher->fetch('nononononono', $destination);
     $this->assertNull($generated);
     $this->assertFalse(file_exists($destination));
 }
예제 #2
0
 /**
  * @param string $imageDir
  * @param null   $defaultImg
  * @return FaviconFetcher
  */
 public static function create($imageDir = '/tmp/', $defaultImg = null)
 {
     if (is_null($defaultImg) || !file_exists($defaultImg)) {
         $defaultImg = __DIR__ . '/../tests/Resources/default_favicon_image.png';
     }
     $getFaviconService = new GetFaviconFetcher();
     $converter = new ImageMagickIcoPngConverter();
     $getFaviconService->setConverter($converter);
     return new self([new GoogleFetcher(), $getFaviconService, new FaviconIcoFetcher($converter), new DefaultFetcher($defaultImg)], new DomainFileNameResolver($prefix = '', $suffix = '.png'), $imageDir);
 }