Skip to content

Commit

Permalink
ImageUrlWithSizeHelper::limitSizeInImageUrl is no longer static
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasLudvik committed Jan 29, 2025
1 parent 8126458 commit 9902e2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Model/LuigisBoxBrandFeedItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ class LuigisBoxBrandFeedItemFactory
/**
* @param \Shopsys\FrameworkBundle\Component\Router\FriendlyUrl\FriendlyUrlFacade $friendlyUrlFacade
* @param \Shopsys\FrameworkBundle\Component\Image\ImageFacade $imageFacade
* @param \Shopsys\FrameworkBundle\Component\Image\ImageUrlWithSizeHelper $imageUrlWithSizeHelper
*/
public function __construct(
protected readonly FriendlyUrlFacade $friendlyUrlFacade,
protected readonly ImageFacade $imageFacade,
protected readonly ImageUrlWithSizeHelper $imageUrlWithSizeHelper,
) {
}

Expand All @@ -31,7 +33,7 @@ public function __construct(
public function create(Brand $brand, DomainConfig $domainConfig): LuigisBoxBrandFeedItem
{
try {
$imageUrl = ImageUrlWithSizeHelper::limitSizeInImageUrl($this->imageFacade->getImageUrl($domainConfig, $brand), 100, 100);
$imageUrl = $this->imageUrlWithSizeHelper->limitSizeInImageUrl($this->imageFacade->getImageUrl($domainConfig, $brand), 100, 100);
} catch (ImageNotFoundException) {
$imageUrl = null;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/LuigisBoxBrandFeedItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Shopsys\FrameworkBundle\Component\Domain\Config\DomainConfig;
use Shopsys\FrameworkBundle\Component\Domain\Domain;
use Shopsys\FrameworkBundle\Component\Image\ImageFacade;
use Shopsys\FrameworkBundle\Component\Image\ImageUrlWithSizeHelper;
use Shopsys\FrameworkBundle\Component\Router\FriendlyUrl\FriendlyUrlFacade;
use Shopsys\FrameworkBundle\Model\Product\Brand\Brand;

Expand Down Expand Up @@ -40,7 +41,7 @@ public function testBrandFeedItemCreation(): void
$imageFacadeMock->method('getImageUrl')
->with($defaultDomain, $brand)->willReturn(self::BRAND_IMAGE_URL);

$luigisBoxBrandFeedItemFactory = new LuigisBoxBrandFeedItemFactory($friendlyUrlFacadeMock, $imageFacadeMock);
$luigisBoxBrandFeedItemFactory = new LuigisBoxBrandFeedItemFactory($friendlyUrlFacadeMock, $imageFacadeMock, new ImageUrlWithSizeHelper());
$luigisBoxBrandFeedItem = $luigisBoxBrandFeedItemFactory->create($brand, $defaultDomain);

$this->assertSame(LuigisBoxBrandFeedItem::UNIQUE_BRAND_IDENTIFIER_PREFIX . '-' . self::BRAND_ID, $luigisBoxBrandFeedItem->getIdentity());
Expand Down

0 comments on commit 9902e2e

Please sign in to comment.