From 832bad6d7e69dbbcf1b4876dd252be50749ae416 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Wed, 31 Jan 2018 10:04:23 +0200 Subject: [PATCH 1/4] Product image builder - Override attributes when builder used multiple times (cherry picked from commit 44e8747) --- .../Catalog/Block/Product/ImageBuilder.php | 11 +- .../Unit/Block/Product/ImageBuilderTest.php | 228 ++++++++++++++++-- 2 files changed, 215 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/ImageBuilder.php b/app/code/Magento/Catalog/Block/Product/ImageBuilder.php index 04d30270cbb62..b752000f5a19d 100644 --- a/app/code/Magento/Catalog/Block/Product/ImageBuilder.php +++ b/app/code/Magento/Catalog/Block/Product/ImageBuilder.php @@ -6,6 +6,7 @@ namespace Magento\Catalog\Block\Product; use Magento\Catalog\Helper\ImageFactory as HelperFactory; +use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Image\NotLoadInfoImageException; class ImageBuilder @@ -21,7 +22,7 @@ class ImageBuilder protected $helperFactory; /** - * @var \Magento\Catalog\Model\Product + * @var Product */ protected $product; @@ -50,10 +51,10 @@ public function __construct( /** * Set product * - * @param \Magento\Catalog\Model\Product $product + * @param Product $product * @return $this */ - public function setProduct(\Magento\Catalog\Model\Product $product) + public function setProduct(Product $product) { $this->product = $product; return $this; @@ -79,9 +80,7 @@ public function setImageId($imageId) */ public function setAttributes(array $attributes) { - if ($attributes) { - $this->attributes = $attributes; - } + $this->attributes = $attributes; return $this; } diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php index e0b5d6ef3992a..ea11aa2c5898f 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php @@ -5,22 +5,27 @@ */ namespace Magento\Catalog\Test\Unit\Block\Product; +use Magento\Catalog\Block\Product\ImageBuilder; +use Magento\Catalog\Block\Product\ImageFactory; +use Magento\Catalog\Helper\Image; +use Magento\Catalog\Model\Product; + class ImageBuilderTest extends \PHPUnit\Framework\TestCase { /** - * @var \Magento\Catalog\Block\Product\ImageBuilder + * @var ImageBuilder */ - protected $model; + private $model; /** * @var \Magento\Catalog\Helper\ImageFactory|\PHPUnit_Framework_MockObject_MockObject */ - protected $helperFactory; + private $helperFactory; /** - * @var \Magento\Catalog\Block\Product\ImageFactory|\PHPUnit_Framework_MockObject_MockObject + * @var ImageFactory|\PHPUnit_Framework_MockObject_MockObject */ - protected $imageFactory; + private $imageFactory; protected function setUp() { @@ -29,25 +34,22 @@ protected function setUp() ->setMethods(['create']) ->getMock(); - $this->imageFactory = $this->getMockBuilder(\Magento\Catalog\Block\Product\ImageFactory::class) + $this->imageFactory = $this->getMockBuilder(ImageFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $this->model = new \Magento\Catalog\Block\Product\ImageBuilder( - $this->helperFactory, - $this->imageFactory - ); + $this->model = new ImageBuilder($this->helperFactory, $this->imageFactory); } public function testSetProduct() { - $productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) + $productMock = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() ->getMock(); $this->assertInstanceOf( - \Magento\Catalog\Block\Product\ImageBuilder::class, + ImageBuilder::class, $this->model->setProduct($productMock) ); } @@ -57,7 +59,7 @@ public function testSetImageId() $imageId = 'test_image_id'; $this->assertInstanceOf( - \Magento\Catalog\Block\Product\ImageBuilder::class, + ImageBuilder::class, $this->model->setImageId($imageId) ); } @@ -68,7 +70,7 @@ public function testSetAttributes() 'name' => 'value', ]; $this->assertInstanceOf( - \Magento\Catalog\Block\Product\ImageBuilder::class, + ImageBuilder::class, $this->model->setAttributes($attributes) ); } @@ -81,11 +83,11 @@ public function testCreate($data, $expected) { $imageId = 'test_image_id'; - $productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) + $productMock = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() ->getMock(); - $helperMock = $this->getMockBuilder(\Magento\Catalog\Helper\Image::class) + $helperMock = $this->getMockBuilder(Image::class) ->disableOriginalConstructor() ->getMock(); $helperMock->expects($this->once()) @@ -131,6 +133,77 @@ public function testCreate($data, $expected) $this->assertInstanceOf(\Magento\Catalog\Block\Product\Image::class, $this->model->create()); } + /** + * Check if custom attributes will be overridden when builder used few times + * @param array $data + * @dataProvider createMultipleCallsDataProvider + */ + public function testCreateMultipleCalls($data) + { + list ($firstCall, $secondCall) = array_values($data); + + $imageId = 'test_image_id'; + + $productMock = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->getMock(); + + $helperMock = $this->getMockBuilder(Image::class) + ->disableOriginalConstructor() + ->getMock(); + $helperMock->expects($this->exactly(2)) + ->method('init') + ->with($productMock, $imageId) + ->willReturnSelf(); + + $helperMock->expects($this->exactly(2)) + ->method('getFrame') + ->willReturnOnConsecutiveCalls($firstCall['data']['frame'], $secondCall['data']['frame']); + $helperMock->expects($this->exactly(2)) + ->method('getUrl') + ->willReturnOnConsecutiveCalls($firstCall['data']['url'], $secondCall['data']['url']); + $helperMock->expects($this->exactly(4)) + ->method('getWidth') + ->willReturnOnConsecutiveCalls($firstCall['data']['width'], $firstCall['data']['width'], $secondCall['data']['width'], $secondCall['data']['width']); + $helperMock->expects($this->exactly(4)) + ->method('getHeight') + ->willReturnOnConsecutiveCalls($firstCall['data']['height'], $firstCall['data']['height'], $secondCall['data']['height'], $secondCall['data']['height']); + $helperMock->expects($this->exactly(2)) + ->method('getLabel') + ->willReturnOnConsecutiveCalls($firstCall['data']['label'], $secondCall['data']['label']); + $helperMock->expects($this->exactly(2)) + ->method('getResizedImageInfo') + ->willReturnOnConsecutiveCalls($firstCall['data']['imagesize'], $secondCall['data']['imagesize']); + $this->helperFactory->expects($this->exactly(2)) + ->method('create') + ->willReturn($helperMock); + + $imageMock = $this->getMockBuilder(\Magento\Catalog\Block\Product\Image::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->imageFactory->expects($this->at(0)) + ->method('create') + ->with($firstCall['expected']) + ->willReturn($imageMock); + + $this->imageFactory->expects($this->at(1)) + ->method('create') + ->with($secondCall['expected']) + ->willReturn($imageMock); + + $this->model->setProduct($productMock); + $this->model->setImageId($imageId); + $this->model->setAttributes($firstCall['data']['custom_attributes']); + + $this->assertInstanceOf(\Magento\Catalog\Block\Product\Image::class, $this->model->create()); + + $this->model->setProduct($productMock); + $this->model->setImageId($imageId); + $this->model->setAttributes($secondCall['data']['custom_attributes']); + $this->assertInstanceOf(\Magento\Catalog\Block\Product\Image::class, $this->model->create()); + } + /** * @return array */ @@ -154,7 +227,7 @@ public function createDataProvider() 'width' => 100, 'height' => 100, 'label' => 'test_label', - 'ratio' => 1, + 'ratio' => 1, 'custom_attributes' => '', 'resized_image_width' => 100, 'resized_image_height' => 100, @@ -181,7 +254,7 @@ public function createDataProvider() 'width' => 100, 'height' => 50, 'label' => 'test_label_2', - 'ratio' => 0.5, + 'ratio' => 0.5, 'custom_attributes' => 'name_1="value_1" name_2="value_2"', 'resized_image_width' => 120, 'resized_image_height' => 70, @@ -190,4 +263,123 @@ public function createDataProvider() ], ]; } + + /** + * @return array + */ + public function createMultipleCallsDataProvider() + { + return [ + [ + [ + 'without_attributes' => [ + 'data' => [ + 'frame' => 0, + 'url' => 'test_url_1', + 'width' => 100, + 'height' => 100, + 'label' => 'test_label', + 'custom_attributes' => [], + 'imagesize' => [100, 100], + ], + 'expected' => [ + 'data' => [ + 'template' => 'Magento_Catalog::product/image_with_borders.phtml', + 'image_url' => 'test_url_1', + 'width' => 100, + 'height' => 100, + 'label' => 'test_label', + 'ratio' => 1, + 'custom_attributes' => '', + 'resized_image_width' => 100, + 'resized_image_height' => 100, + ], + ], + ], + 'with_attributes' => [ + 'data' => [ + 'frame' => 1, + 'url' => 'test_url_2', + 'width' => 100, + 'height' => 50, + 'label' => 'test_label_2', + 'custom_attributes' => [ + 'name_1' => 'value_1', + 'name_2' => 'value_2', + ], + 'imagesize' => [120, 70], + ], + 'expected' => [ + 'data' => [ + 'template' => 'Magento_Catalog::product/image.phtml', + 'image_url' => 'test_url_2', + 'width' => 100, + 'height' => 50, + 'label' => 'test_label_2', + 'ratio' => 0.5, + 'custom_attributes' => 'name_1="value_1" name_2="value_2"', + 'resized_image_width' => 120, + 'resized_image_height' => 70, + ], + ], + ], + ], + ], + [ + [ + 'with_attributes' => [ + 'data' => [ + 'frame' => 1, + 'url' => 'test_url_2', + 'width' => 100, + 'height' => 50, + 'label' => 'test_label_2', + 'custom_attributes' => [ + 'name_1' => 'value_1', + 'name_2' => 'value_2', + ], + 'imagesize' => [120, 70], + ], + 'expected' => [ + 'data' => [ + 'template' => 'Magento_Catalog::product/image.phtml', + 'image_url' => 'test_url_2', + 'width' => 100, + 'height' => 50, + 'label' => 'test_label_2', + 'ratio' => 0.5, + 'custom_attributes' => 'name_1="value_1" name_2="value_2"', + 'resized_image_width' => 120, + 'resized_image_height' => 70, + ], + ], + ], + 'without_attributes' => [ + 'data' => [ + 'frame' => 0, + 'url' => 'test_url_1', + 'width' => 100, + 'height' => 100, + 'label' => 'test_label', + 'custom_attributes' => [], + 'imagesize' => [100, 100], + ], + 'expected' => [ + 'data' => [ + 'template' => 'Magento_Catalog::product/image_with_borders.phtml', + 'image_url' => 'test_url_1', + 'width' => 100, + 'height' => 100, + 'label' => 'test_label', + 'ratio' => 1, + 'custom_attributes' => '', + 'resized_image_width' => 100, + 'resized_image_height' => 100, + ], + ], + ], + ], + ], + ]; + } } From b2736b0608d9ab393d3847bddb4479a96675fd68 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Wed, 31 Jan 2018 10:05:19 +0200 Subject: [PATCH 2/4] Product image builder - Override attributes when builder used multiple times (cherry picked from commit 9f0b1af) --- .../Test/Unit/Block/Product/ImageBuilderTest.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php index ea11aa2c5898f..9421e183cedad 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php @@ -164,10 +164,20 @@ public function testCreateMultipleCalls($data) ->willReturnOnConsecutiveCalls($firstCall['data']['url'], $secondCall['data']['url']); $helperMock->expects($this->exactly(4)) ->method('getWidth') - ->willReturnOnConsecutiveCalls($firstCall['data']['width'], $firstCall['data']['width'], $secondCall['data']['width'], $secondCall['data']['width']); + ->willReturnOnConsecutiveCalls( + $firstCall['data']['width'], + $firstCall['data']['width'], + $secondCall['data']['width'], + $secondCall['data']['width'] + ); $helperMock->expects($this->exactly(4)) ->method('getHeight') - ->willReturnOnConsecutiveCalls($firstCall['data']['height'], $firstCall['data']['height'], $secondCall['data']['height'], $secondCall['data']['height']); + ->willReturnOnConsecutiveCalls( + $firstCall['data']['height'], + $firstCall['data']['height'], + $secondCall['data']['height'], + $secondCall['data']['height'] + ); $helperMock->expects($this->exactly(2)) ->method('getLabel') ->willReturnOnConsecutiveCalls($firstCall['data']['label'], $secondCall['data']['label']); From be4495cd20611a5411ad37832868ef6f74224857 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Wed, 31 Jan 2018 10:11:10 +0200 Subject: [PATCH 3/4] Product image builder - Override attributes when builder used multiple times Simplify getting mocks in unit tests (cherry picked from commit f721b69) --- .../Unit/Block/Product/ImageBuilderTest.php | 38 +++++-------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php index 9421e183cedad..8d3f3f5d3fcc6 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php @@ -29,24 +29,16 @@ class ImageBuilderTest extends \PHPUnit\Framework\TestCase protected function setUp() { - $this->helperFactory = $this->getMockBuilder(\Magento\Catalog\Helper\ImageFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); + $this->helperFactory = $this->createPartialMock(\Magento\Catalog\Helper\ImageFactory::class, ['create']); - $this->imageFactory = $this->getMockBuilder(ImageFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); + $this->imageFactory = $this->createPartialMock(ImageFactory::class, ['create']); $this->model = new ImageBuilder($this->helperFactory, $this->imageFactory); } public function testSetProduct() { - $productMock = $this->getMockBuilder(Product::class) - ->disableOriginalConstructor() - ->getMock(); + $productMock = $this->createMock(Product::class); $this->assertInstanceOf( ImageBuilder::class, @@ -83,13 +75,9 @@ public function testCreate($data, $expected) { $imageId = 'test_image_id'; - $productMock = $this->getMockBuilder(Product::class) - ->disableOriginalConstructor() - ->getMock(); + $productMock = $this->createMock(Product::class); - $helperMock = $this->getMockBuilder(Image::class) - ->disableOriginalConstructor() - ->getMock(); + $helperMock = $this->createMock(Image::class); $helperMock->expects($this->once()) ->method('init') ->with($productMock, $imageId) @@ -118,9 +106,7 @@ public function testCreate($data, $expected) ->method('create') ->willReturn($helperMock); - $imageMock = $this->getMockBuilder(\Magento\Catalog\Block\Product\Image::class) - ->disableOriginalConstructor() - ->getMock(); + $imageMock = $this->createMock(\Magento\Catalog\Block\Product\Image::class); $this->imageFactory->expects($this->once()) ->method('create') @@ -144,13 +130,9 @@ public function testCreateMultipleCalls($data) $imageId = 'test_image_id'; - $productMock = $this->getMockBuilder(Product::class) - ->disableOriginalConstructor() - ->getMock(); + $productMock = $this->createMock(Product::class); - $helperMock = $this->getMockBuilder(Image::class) - ->disableOriginalConstructor() - ->getMock(); + $helperMock = $this->createMock(Image::class); $helperMock->expects($this->exactly(2)) ->method('init') ->with($productMock, $imageId) @@ -188,9 +170,7 @@ public function testCreateMultipleCalls($data) ->method('create') ->willReturn($helperMock); - $imageMock = $this->getMockBuilder(\Magento\Catalog\Block\Product\Image::class) - ->disableOriginalConstructor() - ->getMock(); + $imageMock = $this->createMock(\Magento\Catalog\Block\Product\Image::class); $this->imageFactory->expects($this->at(0)) ->method('create') From 2ad1f52256adec846129597db1bde180b927095c Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Wed, 31 Jan 2018 11:04:40 +0200 Subject: [PATCH 4/4] Product image builder - Override attributes when builder used multiple times Extract test data with and without attributes to separate methods (cherry picked from commit 775ec3a) --- .../Unit/Block/Product/ImageBuilderTest.php | 220 ++++++------------ 1 file changed, 69 insertions(+), 151 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php index 8d3f3f5d3fcc6..dc152aaf05867 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php @@ -197,58 +197,61 @@ public function testCreateMultipleCalls($data) /** * @return array */ - public function createDataProvider() + public function createDataProvider(): array + { + return [ + $this->getTestDataWithoutAttributes(), + $this->getTestDataWithAttributes(), + ]; + } + + /** + * @return array + */ + public function createMultipleCallsDataProvider(): array { return [ [ - 'data' => [ - 'frame' => 0, - 'url' => 'test_url_1', - 'width' => 100, - 'height' => 100, - 'label' => 'test_label', - 'custom_attributes' => [], - 'imagesize' => [100, 100], - ], - 'expected' => [ - 'data' => [ - 'template' => 'Magento_Catalog::product/image_with_borders.phtml', - 'image_url' => 'test_url_1', - 'width' => 100, - 'height' => 100, - 'label' => 'test_label', - 'ratio' => 1, - 'custom_attributes' => '', - 'resized_image_width' => 100, - 'resized_image_height' => 100, - ], + [ + 'without_attributes' => $this->getTestDataWithoutAttributes(), + 'with_attributes' => $this->getTestDataWithAttributes(), ], ], [ + [ + 'with_attributes' => $this->getTestDataWithAttributes(), + 'without_attributes' => $this->getTestDataWithoutAttributes(), + ], + ], + ]; + } + + /** + * @return array + */ + private function getTestDataWithoutAttributes(): array + { + return [ + 'data' => [ + 'frame' => 0, + 'url' => 'test_url_1', + 'width' => 100, + 'height' => 100, + 'label' => 'test_label', + 'custom_attributes' => [], + 'imagesize' => [100, 100], + ], + 'expected' => [ 'data' => [ - 'frame' => 1, - 'url' => 'test_url_2', + 'template' => 'Magento_Catalog::product/image_with_borders.phtml', + 'image_url' => 'test_url_1', 'width' => 100, - 'height' => 50, - 'label' => 'test_label_2', - 'custom_attributes' => [ - 'name_1' => 'value_1', - 'name_2' => 'value_2', - ], - 'imagesize' => [120, 70], - ], - 'expected' => [ - 'data' => [ - 'template' => 'Magento_Catalog::product/image.phtml', - 'image_url' => 'test_url_2', - 'width' => 100, - 'height' => 50, - 'label' => 'test_label_2', - 'ratio' => 0.5, - 'custom_attributes' => 'name_1="value_1" name_2="value_2"', - 'resized_image_width' => 120, - 'resized_image_height' => 70, - ], + 'height' => 100, + 'label' => 'test_label', + 'ratio' => 1, + 'custom_attributes' => '', + 'resized_image_width' => 100, + 'resized_image_height' => 100, ], ], ]; @@ -257,117 +260,32 @@ public function createDataProvider() /** * @return array */ - public function createMultipleCallsDataProvider() + private function getTestDataWithAttributes(): array { return [ - [ - [ - 'without_attributes' => [ - 'data' => [ - 'frame' => 0, - 'url' => 'test_url_1', - 'width' => 100, - 'height' => 100, - 'label' => 'test_label', - 'custom_attributes' => [], - 'imagesize' => [100, 100], - ], - 'expected' => [ - 'data' => [ - 'template' => 'Magento_Catalog::product/image_with_borders.phtml', - 'image_url' => 'test_url_1', - 'width' => 100, - 'height' => 100, - 'label' => 'test_label', - 'ratio' => 1, - 'custom_attributes' => '', - 'resized_image_width' => 100, - 'resized_image_height' => 100, - ], - ], - ], - 'with_attributes' => [ - 'data' => [ - 'frame' => 1, - 'url' => 'test_url_2', - 'width' => 100, - 'height' => 50, - 'label' => 'test_label_2', - 'custom_attributes' => [ - 'name_1' => 'value_1', - 'name_2' => 'value_2', - ], - 'imagesize' => [120, 70], - ], - 'expected' => [ - 'data' => [ - 'template' => 'Magento_Catalog::product/image.phtml', - 'image_url' => 'test_url_2', - 'width' => 100, - 'height' => 50, - 'label' => 'test_label_2', - 'ratio' => 0.5, - 'custom_attributes' => 'name_1="value_1" name_2="value_2"', - 'resized_image_width' => 120, - 'resized_image_height' => 70, - ], - ], - ], + 'data' => [ + 'frame' => 1, + 'url' => 'test_url_2', + 'width' => 100, + 'height' => 50, + 'label' => 'test_label_2', + 'custom_attributes' => [ + 'name_1' => 'value_1', + 'name_2' => 'value_2', ], + 'imagesize' => [120, 70], ], - [ - [ - 'with_attributes' => [ - 'data' => [ - 'frame' => 1, - 'url' => 'test_url_2', - 'width' => 100, - 'height' => 50, - 'label' => 'test_label_2', - 'custom_attributes' => [ - 'name_1' => 'value_1', - 'name_2' => 'value_2', - ], - 'imagesize' => [120, 70], - ], - 'expected' => [ - 'data' => [ - 'template' => 'Magento_Catalog::product/image.phtml', - 'image_url' => 'test_url_2', - 'width' => 100, - 'height' => 50, - 'label' => 'test_label_2', - 'ratio' => 0.5, - 'custom_attributes' => 'name_1="value_1" name_2="value_2"', - 'resized_image_width' => 120, - 'resized_image_height' => 70, - ], - ], - ], - 'without_attributes' => [ - 'data' => [ - 'frame' => 0, - 'url' => 'test_url_1', - 'width' => 100, - 'height' => 100, - 'label' => 'test_label', - 'custom_attributes' => [], - 'imagesize' => [100, 100], - ], - 'expected' => [ - 'data' => [ - 'template' => 'Magento_Catalog::product/image_with_borders.phtml', - 'image_url' => 'test_url_1', - 'width' => 100, - 'height' => 100, - 'label' => 'test_label', - 'ratio' => 1, - 'custom_attributes' => '', - 'resized_image_width' => 100, - 'resized_image_height' => 100, - ], - ], - ], + 'expected' => [ + 'data' => [ + 'template' => 'Magento_Catalog::product/image.phtml', + 'image_url' => 'test_url_2', + 'width' => 100, + 'height' => 50, + 'label' => 'test_label_2', + 'ratio' => 0.5, + 'custom_attributes' => 'name_1="value_1" name_2="value_2"', + 'resized_image_width' => 120, + 'resized_image_height' => 70, ], ], ];