Skip to content

Commit e7e4a88

Browse files
author
Volodymyr Klymenko
authored
Merge pull request #152 from magento-east/EAST-CADENCE-1-CE
[East] Bugfixes and update of github issue template
2 parents 989af63 + 05a87d5 commit e7e4a88

File tree

10 files changed

+241
-21
lines changed

10 files changed

+241
-21
lines changed

ISSUE_TEMPLATE.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1-
Steps to reproduce
2-
--
3-
1. Install Magento from `develop` branch.
4-
2. [Example] Add Configurable Product to the cart.
5-
3. ...
1+
<!--- Provide a general summary of the issue in the Title above -->
2+
<!--- Before adding new issues, please, check this article https://github.com/magento/magento2/wiki/Issue-reporting-guidelines-->
63

7-
Expected result
8-
--
9-
1. [Example] Configurable product added to the shopping cart.
10-
2. ...
4+
### Preconditions
5+
<!--- Provide a more detailed information of environment you use -->
6+
<!--- Magento version, tag, HEAD, etc., PHP & MySQL version, etc.. -->
7+
1.
8+
2.
119

12-
Actual result
13-
--
14-
1. [Example] Error message appears: "Cannot save quote".
15-
2. [Screenshot, logs]
16-
3. ...
10+
### Steps to reproduce
11+
<!--- Provide a set of unambiguous steps to reproduce this bug include code, if relevant -->
12+
1.
13+
2.
14+
3.
15+
16+
### Expected result
17+
<!--- Tell us what should happen -->
18+
1.
19+
20+
### Actual result
21+
<!--- Tell us what happens instead -->
22+
1. [Screenshot, logs]
23+
24+
<!--- (This may be platform independent comment) -->

app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Magento\Backend\Block\Media\Uploader;
1717
use Magento\Framework\View\Element\AbstractBlock;
1818
use Magento\Framework\App\Filesystem\DirectoryList;
19+
use Magento\Framework\Exception\FileSystemException;
1920

2021
class Content extends \Magento\Backend\Block\Widget
2122
{
@@ -34,6 +35,16 @@ class Content extends \Magento\Backend\Block\Widget
3435
*/
3536
protected $_jsonEncoder;
3637

38+
/**
39+
* @var \Magento\Catalog\Helper\Image
40+
*/
41+
private $imageHelper;
42+
43+
/**
44+
* @var \Magento\Framework\View\Asset\Repository
45+
*/
46+
private $assetRepo;
47+
3748
/**
3849
* @param \Magento\Backend\Block\Template\Context $context
3950
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
@@ -128,12 +139,22 @@ public function getImagesJson()
128139
is_array($value['images']) &&
129140
count($value['images'])
130141
) {
131-
$directory = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA);
142+
$mediaDir = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA);
132143
$images = $this->sortImagesByPosition($value['images']);
133144
foreach ($images as &$image) {
134145
$image['url'] = $this->_mediaConfig->getMediaUrl($image['file']);
135-
$fileHandler = $directory->stat($this->_mediaConfig->getMediaPath($image['file']));
136-
$image['size'] = $fileHandler['size'];
146+
try {
147+
$fileHandler = $mediaDir->stat($this->_mediaConfig->getMediaPath($image['file']));
148+
$image['size'] = $fileHandler['size'];
149+
} catch (FileSystemException $e) {
150+
$staticDir = $this->_filesystem->getDirectoryRead(DirectoryList::STATIC_VIEW);
151+
$image['url'] = $this->getImageHelper()->getDefaultPlaceholderUrl('thumbnail');
152+
$fileHandler = $staticDir->stat(
153+
$this->getAssetRepo()->createAsset($this->getImageHelper()->getPlaceholder('thumbnail'))->getPath()
154+
);
155+
$image['size'] = $fileHandler['size'];
156+
$this->_logger->warning($e);
157+
}
137158
}
138159
return $this->_jsonEncoder->encode($images);
139160
}
@@ -227,4 +248,31 @@ public function getImageTypesJson()
227248
{
228249
return $this->_jsonEncoder->encode($this->getImageTypes());
229250
}
251+
252+
/**
253+
* @return \Magento\Catalog\Helper\Image
254+
* @deprecated
255+
*/
256+
private function getImageHelper()
257+
{
258+
if ($this->imageHelper === null) {
259+
$this->imageHelper = \Magento\Framework\App\ObjectManager::getInstance()
260+
->get('Magento\Catalog\Helper\Image');
261+
}
262+
return $this->imageHelper;
263+
}
264+
265+
/**
266+
* @return \Magento\Framework\View\Asset\Repository
267+
* @deprecated
268+
*/
269+
private function getAssetRepo()
270+
{
271+
if ($this->assetRepo === null) {
272+
$this->assetRepo = \Magento\Framework\App\ObjectManager::getInstance()
273+
->get('\Magento\Framework\View\Asset\Repository');
274+
}
275+
276+
return $this->assetRepo;
277+
}
230278
}

app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,16 @@ public function showMinimalPrice()
118118
&& $minimalPriceAValue
119119
&& $minimalPriceAValue < $finalPriceValue;
120120
}
121+
122+
/**
123+
* {@inheritdoc}
124+
*
125+
* @return array
126+
*/
127+
public function getCacheKeyInfo()
128+
{
129+
$cacheKeys = parent::getCacheKeyInfo();
130+
$cacheKeys['display_minimal_price'] = $this->getDisplayMinimalPrice();
131+
return $cacheKeys;
132+
}
121133
}

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php

Lines changed: 113 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Framework\Filesystem;
99
use Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content;
10+
use Magento\Framework\Phrase;
1011

1112
class ContentTest extends \PHPUnit_Framework_TestCase
1213
{
@@ -40,14 +41,30 @@ class ContentTest extends \PHPUnit_Framework_TestCase
4041
*/
4142
protected $galleryMock;
4243

44+
/**
45+
* @var \Magento\Catalog\Helper\Image|\PHPUnit_Framework_MockObject_MockObject
46+
*/
47+
protected $imageHelper;
48+
49+
/**
50+
* @var \Magento\Framework\View\Asset\Repository|\PHPUnit_Framework_MockObject_MockObject
51+
*/
52+
protected $assetRepo;
53+
4354
/**
4455
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
4556
*/
4657
protected $objectManager;
4758

4859
public function setUp()
4960
{
50-
$this->fileSystemMock = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);
61+
$this->fileSystemMock = $this->getMock(
62+
'Magento\Framework\Filesystem',
63+
['stat', 'getDirectoryRead'],
64+
[],
65+
'',
66+
false
67+
);
5168
$this->readMock = $this->getMock('Magento\Framework\Filesystem\Directory\ReadInterface');
5269
$this->galleryMock = $this->getMock(
5370
'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery',
@@ -56,7 +73,13 @@ public function setUp()
5673
'',
5774
false
5875
);
59-
$this->mediaConfigMock = $this->getMock('Magento\Catalog\Model\Product\Media\Config', [], [], '', false);
76+
$this->mediaConfigMock = $this->getMock(
77+
'Magento\Catalog\Model\Product\Media\Config',
78+
['getMediaUrl', 'getMediaPath'],
79+
[],
80+
'',
81+
false
82+
);
6083
$this->jsonEncoderMock = $this->getMockBuilder('Magento\Framework\Json\EncoderInterface')
6184
->disableOriginalConstructor()
6285
->getMock();
@@ -130,7 +153,6 @@ public function testGetImagesJson()
130153

131154
$this->mediaConfigMock->expects($this->any())->method('getMediaUrl')->willReturnMap($url);
132155
$this->mediaConfigMock->expects($this->any())->method('getMediaPath')->willReturnMap($mediaPath);
133-
134156
$this->readMock->expects($this->any())->method('stat')->willReturnMap($sizeMap);
135157
$this->jsonEncoderMock->expects($this->once())->method('encode')->willReturnCallback('json_encode');
136158

@@ -144,4 +166,92 @@ public function testGetImagesJsonWithoutImages()
144166

145167
$this->assertSame('[]', $this->content->getImagesJson());
146168
}
169+
170+
public function testGetImagesJsonWithException()
171+
{
172+
$this->imageHelper = $this->getMockBuilder('Magento\Catalog\Helper\Image')
173+
->disableOriginalConstructor()
174+
->setMethods(['getDefaultPlaceholderUrl', 'getPlaceholder'])
175+
->getMock();
176+
177+
$this->assetRepo = $this->getMockBuilder('Magento\Framework\View\Asset\Repository')
178+
->disableOriginalConstructor()
179+
->setMethods(['createAsset', 'getPath'])
180+
->getMock();
181+
182+
$this->objectManager->setBackwardCompatibleProperty(
183+
$this->content,
184+
'imageHelper',
185+
$this->imageHelper
186+
);
187+
188+
$this->objectManager->setBackwardCompatibleProperty(
189+
$this->content,
190+
'assetRepo',
191+
$this->assetRepo
192+
);
193+
194+
$placeholderUrl = 'url_to_the_placeholder/placeholder.jpg';
195+
196+
$sizePlaceholder = ['size' => 399659];
197+
198+
$imagesResult = [
199+
[
200+
'value_id' => '2',
201+
'file' => 'file_2.jpg',
202+
'media_type' => 'image',
203+
'position' => '0',
204+
'url' => 'url_to_the_placeholder/placeholder.jpg',
205+
'size' => 399659
206+
],
207+
[
208+
'value_id' => '1',
209+
'file' => 'file_1.jpg',
210+
'media_type' => 'image',
211+
'position' => '1',
212+
'url' => 'url_to_the_placeholder/placeholder.jpg',
213+
'size' => 399659
214+
]
215+
];
216+
217+
$images = [
218+
'images' => [
219+
[
220+
'value_id' => '1',
221+
'file' => 'file_1.jpg',
222+
'media_type' => 'image',
223+
'position' => '1'
224+
],
225+
[
226+
'value_id' => '2',
227+
'file' => 'file_2.jpg',
228+
'media_type' => 'image',
229+
'position' => '0'
230+
]
231+
]
232+
];
233+
234+
$this->content->setElement($this->galleryMock);
235+
$this->galleryMock->expects($this->once())->method('getImages')->willReturn($images);
236+
$this->fileSystemMock->expects($this->any())->method('getDirectoryRead')->willReturn($this->readMock);
237+
$this->mediaConfigMock->expects($this->any())->method('getMediaUrl');
238+
$this->mediaConfigMock->expects($this->any())->method('getMediaPath');
239+
$this->readMock->expects($this->any())->method('stat')->willReturnOnConsecutiveCalls(
240+
$this->throwException(
241+
new \Magento\Framework\Exception\FileSystemException(new \Magento\Framework\Phrase('test'))
242+
),
243+
$sizePlaceholder,
244+
$this->throwException(
245+
new \Magento\Framework\Exception\FileSystemException(new \Magento\Framework\Phrase('test'))
246+
),
247+
$sizePlaceholder
248+
);
249+
$this->imageHelper->expects($this->any())->method('getDefaultPlaceholderUrl')->willReturn($placeholderUrl);
250+
$this->imageHelper->expects($this->any())->method('getPlaceholder');
251+
$this->assetRepo->expects($this->any())->method('createAsset')->willReturnSelf();
252+
$this->assetRepo->expects($this->any())->method('getPath');
253+
$this->jsonEncoderMock->expects($this->once())->method('encode')->willReturnCallback('json_encode');
254+
255+
$this->assertSame(json_encode($imagesResult), $this->content->getImagesJson());
256+
}
147257
}

app/code/Magento/Catalog/Test/Unit/Pricing/Render/FinalPriceBoxTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,22 @@ protected function setUp()
8484
$cacheState = $this->getMockBuilder(\Magento\Framework\App\Cache\StateInterface::class)
8585
->getMockForAbstractClass();
8686

87+
$storeManager = $this->getMockBuilder('\Magento\Store\Model\StoreManagerInterface')
88+
->setMethods(['getStore', 'getCode'])
89+
->getMockForAbstractClass();
90+
$storeManager->expects($this->any())->method('getStore')->willReturnSelf();
91+
92+
$appState = $this->getMockBuilder('\Magento\Framework\App\State')
93+
->disableOriginalConstructor()
94+
->getMock();
95+
96+
$resolver = $this->getMockBuilder('\Magento\Framework\View\Element\Template\File\Resolver')
97+
->disableOriginalConstructor()
98+
->getMock();
99+
100+
$urlBuilder = $this->getMockBuilder('\Magento\Framework\UrlInterface')
101+
->getMockForAbstractClass();
102+
87103
$scopeConfigMock = $this->getMockForAbstractClass('Magento\Framework\App\Config\ScopeConfigInterface');
88104
$context = $this->getMock('Magento\Framework\View\Element\Template\Context', [], [], '', false);
89105
$context->expects($this->any())
@@ -104,6 +120,18 @@ protected function setUp()
104120
$context->expects($this->any())
105121
->method('getCacheState')
106122
->will($this->returnValue($cacheState));
123+
$context->expects($this->any())
124+
->method('getStoreManager')
125+
->will($this->returnValue($storeManager));
126+
$context->expects($this->any())
127+
->method('getAppState')
128+
->will($this->returnValue($appState));
129+
$context->expects($this->any())
130+
->method('getResolver')
131+
->will($this->returnValue($resolver));
132+
$context->expects($this->any())
133+
->method('getUrlBuilder')
134+
->will($this->returnValue($urlBuilder));
107135

108136
$this->rendererPool = $this->getMockBuilder('Magento\Framework\Pricing\Render\RendererPool')
109137
->disableOriginalConstructor()
@@ -338,4 +366,9 @@ public function testHidePrice()
338366

339367
$this->assertEmpty($this->object->toHtml());
340368
}
369+
370+
public function testGetCacheKeyInfo()
371+
{
372+
$this->assertArrayHasKey('display_minimal_price', $this->object->getCacheKeyInfo());
373+
}
341374
}

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ protected function getTierPriceStructure($tierPricePath)
412412
'data' => [
413413
'config' => [
414414
'componentType' => 'dynamicRows',
415-
'label' => __('Tier Price'),
415+
'label' => __('Customer Group Price'),
416416
'renderDefaultRecord' => false,
417417
'recordTemplate' => 'record',
418418
'dataScope' => '',

app/code/Magento/Catalog/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ Images,Images
405405
Select...,Select...
406406
"Advanced Pricing","Advanced Pricing"
407407
"Tier Price","Tier Price"
408+
"Customer Group Price","Customer Group Price"
408409
"Customer Group","Customer Group"
409410
"Special Price From","Special Price From"
410411
To,To

app/code/Magento/PageCache/etc/varnish3.vcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import std;
66
backend default {
77
.host = "/* {{ host }} */";
88
.port = "/* {{ port }} */";
9+
.first_byte_timeout = 600s;
910
}
1011

1112
acl purge {

app/code/Magento/PageCache/etc/varnish4.vcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import std;
77
backend default {
88
.host = "/* {{ host }} */";
99
.port = "/* {{ port }} */";
10+
.first_byte_timeout = 600s;
1011
}
1112

1213
acl purge {

nginx.conf.sample

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ location ~* ^/setup($|/) {
3838
root $MAGE_ROOT;
3939
location ~ ^/setup/index.php {
4040
fastcgi_pass fastcgi_backend;
41+
42+
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
43+
fastcgi_param PHP_VALUE "memory_limit=768M \n max_execution_time=600";
44+
fastcgi_read_timeout 600s;
45+
fastcgi_connect_timeout 600s;
46+
4147
fastcgi_index index.php;
4248
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
4349
include fastcgi_params;

0 commit comments

Comments
 (0)