Skip to content

Commit 7c4057d

Browse files
author
Stanislav Idolov
committed
magento-engcom/magento2ce#2176: fixed failed tests
1 parent 929378f commit 7c4057d

File tree

6 files changed

+42
-8
lines changed

6 files changed

+42
-8
lines changed

app/code/Magento/Catalog/Block/Product/View/Gallery.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
use Magento\Framework\Stdlib\ArrayUtils;
2424

2525
/**
26+
* Product gallery block
27+
*
2628
* @api
2729
* @since 100.0.2
2830
*/
@@ -196,6 +198,8 @@ public function isMainImage($image)
196198
}
197199

198200
/**
201+
* Returns image attribute
202+
*
199203
* @param string $imageId
200204
* @param string $attributeName
201205
* @param string $default
@@ -222,6 +226,8 @@ private function getConfigView()
222226
}
223227

224228
/**
229+
* Returns image gallery config object
230+
*
225231
* @return Collection
226232
*/
227233
private function getGalleryImagesConfig()

app/code/Magento/Catalog/Model/Product/Gallery/CreateHandler.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ public function __construct(
102102
}
103103

104104
/**
105+
* Execute create handler
106+
*
105107
* @param object $product
106108
* @param array $arguments
107109
* @return object
@@ -204,6 +206,8 @@ public function execute($product, $arguments = [])
204206
}
205207

206208
/**
209+
* Returns media gallery atribute instance
210+
*
207211
* @return \Magento\Catalog\Api\Data\ProductAttributeInterface
208212
* @since 101.0.0
209213
*/
@@ -219,6 +223,8 @@ public function getAttribute()
219223
}
220224

221225
/**
226+
* Process delete images
227+
*
222228
* @param \Magento\Catalog\Model\Product $product
223229
* @param array $images
224230
* @return void
@@ -230,6 +236,8 @@ protected function processDeletedImages($product, array &$images)
230236
}
231237

232238
/**
239+
* Process images
240+
*
233241
* @param \Magento\Catalog\Model\Product $product
234242
* @param array $images
235243
* @return void
@@ -292,6 +300,8 @@ protected function processNewImage($product, array &$image)
292300
}
293301

294302
/**
303+
* Duplicate attribute
304+
*
295305
* @param \Magento\Catalog\Model\Product $product
296306
* @return $this
297307
* @since 101.0.0
@@ -360,6 +370,8 @@ private function getSafeFilename($file)
360370
}
361371

362372
/**
373+
* Returns file name according to tmp name
374+
*
363375
* @param string $file
364376
* @return string
365377
* @since 101.0.0
@@ -447,8 +459,10 @@ private function getMediaAttributeCodes()
447459
}
448460

449461
/**
462+
* Process media attribute
463+
*
450464
* @param \Magento\Catalog\Model\Product $product
451-
* @param $mediaAttrCode
465+
* @param string $mediaAttrCode
452466
* @param array $clearImages
453467
* @param array $newImages
454468
*/
@@ -476,8 +490,10 @@ private function processMediaAttribute(
476490
}
477491

478492
/**
493+
* Process media attribute label
494+
*
479495
* @param \Magento\Catalog\Model\Product $product
480-
* @param $mediaAttrCode
496+
* @param string $mediaAttrCode
481497
* @param array $clearImages
482498
* @param array $newImages
483499
* @param array $existImages

app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ private function prepareGetGalleryImagesJsonMocks($hasLabel = true)
147147
->with('product')
148148
->willReturn($productMock);
149149

150+
$this->imageHelper = $this->getMockBuilder(\Magento\Catalog\Helper\Image::class)
151+
->setMethods(['init', 'setImageFile', 'getUrl'])
152+
->disableOriginalConstructor()
153+
->getMock();
154+
150155
$this->imageHelper->expects($this->any())
151156
->method('init')
152157
->willReturnMap([
@@ -159,13 +164,13 @@ private function prepareGetGalleryImagesJsonMocks($hasLabel = true)
159164
->method('setImageFile')
160165
->with('test_file')
161166
->willReturnSelf();
162-
$this->imageHelper->expects($this->at(2))
167+
$this->urlBuilder->expects($this->at(0))
163168
->method('getUrl')
164169
->willReturn('product_page_image_small_url');
165-
$this->imageHelper->expects($this->at(5))
170+
$this->urlBuilder->expects($this->at(1))
166171
->method('getUrl')
167172
->willReturn('product_page_image_medium_url');
168-
$this->imageHelper->expects($this->at(8))
173+
$this->urlBuilder->expects($this->at(2))
169174
->method('getUrl')
170175
->willReturn('product_page_image_large_url');
171176

app/code/Magento/Checkout/Controller/Cart.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ protected function _isInternalUrl($url)
106106
/**
107107
* Get resolved back url
108108
*
109-
* @param null $defaultUrl
110-
*
109+
* @param string|null $defaultUrl
111110
* @return mixed|null|string
112111
*/
113112
protected function getBackUrl($defaultUrl = null)
@@ -129,6 +128,8 @@ protected function getBackUrl($defaultUrl = null)
129128
}
130129

131130
/**
131+
* Is redirect should be performed after the product was added to cart.
132+
*
132133
* @return bool
133134
*/
134135
private function shouldRedirectToCart()

app/code/Magento/Checkout/Controller/Cart/Add.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Magento\Framework\Exception\NoSuchEntityException;
1212

1313
/**
14+
* Controller for processing add to cart action.
15+
*
1416
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1517
*/
1618
class Add extends \Magento\Checkout\Controller\Cart
@@ -205,6 +207,8 @@ protected function goBack($backUrl = null, $product = null)
205207
}
206208

207209
/**
210+
* Returns cart url
211+
*
208212
* @return string
209213
*/
210214
private function getCartUrl()
@@ -213,6 +217,8 @@ private function getCartUrl()
213217
}
214218

215219
/**
220+
* Is redirect should be performed after the product was added to cart.
221+
*
216222
* @return bool
217223
*/
218224
private function shouldRedirectToCart()

app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
}
124124

125125
td {
126-
.admin__field-control {
126+
.admin__field-control {
127127
position: relative;
128128
}
129129
}

0 commit comments

Comments
 (0)