Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 35f404b

Browse files
Merge pull request #1819 from magento-engcom/2.2-develop-prs
[EngCom] Public Pull Requests - 2.2-develop - MAGETWO-85311: Added namespace to product videos fotorama events #12469 #991 - MAGETWO-85300: 8437: Silent error when an email template is not found #970 - MAGETWO-85293: 12613: Verbiage Update Required: Product Image Watermark size Validation Message. #985 - MAGETWO-85286: 8176: LinkManagement::getChildren() does not include product visibility. #986 - MAGETWO-85285: 12482: Sitemap image links in MultiStore #935 - MAGETWO-84955: Set Current Store from Store Code if isUseStoreInUrl #12529 - MAGETWO-84764: NewRelic: Disables Module Deployments, Creates new Deploy Marker Command #12477 - MAGETWO-84439: 12180 Remove unnecessary use operator for Context, causes 503 error i… #12220
2 parents d865ef1 + 35b278d commit 35f404b

File tree

20 files changed

+282
-42
lines changed

20 files changed

+282
-42
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ Submit,Submit
615615
"We don't recognize or support this file extension type.","We don't recognize or support this file extension type."
616616
"Configure Product","Configure Product"
617617
OK,OK
618-
"This value does not follow the specified format (for example, 200X300).","This value does not follow the specified format (for example, 200X300)."
618+
"This value does not follow the specified format (for example, 200x300).","This value does not follow the specified format (for example, 200x300)."
619619
"Select type of option.","Select type of option."
620620
"Please add rows to option.","Please add rows to option."
621621
"Please select items.","Please select items."

app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ define([
2626

2727
return !!(m && m[1] > 0 && m[2] > 0);
2828
},
29-
$.mage.__('This value does not follow the specified format (for example, 200X300).')
29+
$.mage.__('This value does not follow the specified format (for example, 200x300).')
3030
);
3131

3232
return Abstract.extend({

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\ConfigurableProduct\Model\Product\Type;
78

89
use Magento\Catalog\Api\Data\ProductAttributeInterface;
@@ -682,7 +683,7 @@ private function saveConfigurableOptions(ProductInterface $product)
682683
->setProductId($product->getData($metadata->getLinkField()))
683684
->save();
684685
}
685-
/** @var $configurableAttributesCollection \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute\Collection */
686+
/** @var $configurableAttributesCollection \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute\Collection */
686687
$configurableAttributesCollection = $this->_attributeCollectionFactory->create();
687688
$configurableAttributesCollection->setProductFilter($product);
688689
$configurableAttributesCollection->addFieldToFilter(
@@ -1397,7 +1398,16 @@ private function getConfiguredUsedProductCollection(\Magento\Catalog\Model\Produ
13971398
->addFilterByRequiredOptions()
13981399
->setStoreId($product->getStoreId());
13991400

1400-
$requiredAttributes = ['name', 'price', 'weight', 'image', 'thumbnail', 'status', 'media_gallery'];
1401+
$requiredAttributes = [
1402+
'name',
1403+
'price',
1404+
'weight',
1405+
'image',
1406+
'thumbnail',
1407+
'status',
1408+
'visibility',
1409+
'media_gallery'
1410+
];
14011411
foreach ($requiredAttributes as $attributeCode) {
14021412
$collection->addAttributeToSelect($attributeCode);
14031413
}

app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,6 @@ protected function setUp()
197197
->disableOriginalConstructor()
198198
->getMock();
199199

200-
$this->productFactory = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterfaceFactory::class)
201-
->setMethods(['create'])
202-
->disableOriginalConstructor()
203-
->getMock();
204-
205200
$this->salableProcessor = $this->createMock(SalableProcessor::class);
206201

207202
$this->model = $this->objectHelper->getObject(

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,8 @@ protected function sendEmailConfirmation(CustomerInterface $customer, $redirectU
817817
} catch (MailException $e) {
818818
// If we are not able to send a new account email, this should be ignored
819819
$this->logger->critical($e);
820+
} catch (\UnexpectedValueException $e) {
821+
$this->logger->error($e);
820822
}
821823
}
822824

app/code/Magento/Customer/Model/AttributeChecker.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Magento\Customer\Api\AddressMetadataInterface;
99
use Magento\Customer\Api\AddressMetadataManagementInterface;
1010
use Magento\Customer\Model\Metadata\AttributeResolver;
11-
use Magento\Framework\App\Helper\Context;
1211

1312
/**
1413
* Customer attribute checker.

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,4 +1721,102 @@ private function prepareDateTimeFactory()
17211721

17221722
return $dateTime;
17231723
}
1724+
1725+
public function testCreateAccountUnexpectedValueException()
1726+
{
1727+
$websiteId = 1;
1728+
$storeId = null;
1729+
$defaultStoreId = 1;
1730+
$customerId = 1;
1731+
$customerEmail = '[email protected]';
1732+
$newLinkToken = '2jh43j5h2345jh23lh452h345hfuzasd96ofu';
1733+
$exception = new \UnexpectedValueException('Template file was not found');
1734+
1735+
$datetime = $this->prepareDateTimeFactory();
1736+
1737+
$address = $this->createMock(\Magento\Customer\Api\Data\AddressInterface::class);
1738+
$address->expects($this->once())
1739+
->method('setCustomerId')
1740+
->with($customerId);
1741+
$store = $this->createMock(\Magento\Store\Model\Store::class);
1742+
$store->expects($this->once())
1743+
->method('getId')
1744+
->willReturn($defaultStoreId);
1745+
$website = $this->createMock(\Magento\Store\Model\Website::class);
1746+
$website->expects($this->atLeastOnce())
1747+
->method('getStoreIds')
1748+
->willReturn([1, 2, 3]);
1749+
$website->expects($this->once())
1750+
->method('getDefaultStore')
1751+
->willReturn($store);
1752+
$customer = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class);
1753+
$customer->expects($this->atLeastOnce())
1754+
->method('getId')
1755+
->willReturn($customerId);
1756+
$customer->expects($this->atLeastOnce())
1757+
->method('getEmail')
1758+
->willReturn($customerEmail);
1759+
$customer->expects($this->atLeastOnce())
1760+
->method('getWebsiteId')
1761+
->willReturn($websiteId);
1762+
$customer->expects($this->atLeastOnce())
1763+
->method('getStoreId')
1764+
->willReturn($storeId);
1765+
$customer->expects($this->once())
1766+
->method('setStoreId')
1767+
->with($defaultStoreId);
1768+
$customer->expects($this->once())
1769+
->method('getAddresses')
1770+
->willReturn([$address]);
1771+
$customer->expects($this->once())
1772+
->method('setAddresses')
1773+
->with(null);
1774+
$this->customerRepository->expects($this->once())
1775+
->method('get')
1776+
->with($customerEmail)
1777+
->willReturn($customer);
1778+
$this->share->expects($this->once())
1779+
->method('isWebsiteScope')
1780+
->willReturn(true);
1781+
$this->storeManager->expects($this->atLeastOnce())
1782+
->method('getWebsite')
1783+
->with($websiteId)
1784+
->willReturn($website);
1785+
$this->customerRepository->expects($this->atLeastOnce())
1786+
->method('save')
1787+
->willReturn($customer);
1788+
$this->addressRepository->expects($this->atLeastOnce())
1789+
->method('save')
1790+
->with($address);
1791+
$this->customerRepository->expects($this->once())
1792+
->method('getById')
1793+
->with($customerId)
1794+
->willReturn($customer);
1795+
$this->random->expects($this->once())
1796+
->method('getUniqueHash')
1797+
->willReturn($newLinkToken);
1798+
$customerSecure = $this->createPartialMock(
1799+
\Magento\Customer\Model\Data\CustomerSecure::class,
1800+
['setRpToken', 'setRpTokenCreatedAt', 'getPasswordHash']
1801+
);
1802+
$customerSecure->expects($this->any())
1803+
->method('setRpToken')
1804+
->with($newLinkToken);
1805+
$customerSecure->expects($this->any())
1806+
->method('setRpTokenCreatedAt')
1807+
->with($datetime)
1808+
->willReturnSelf();
1809+
$customerSecure->expects($this->any())
1810+
->method('getPasswordHash')
1811+
->willReturn(null);
1812+
$this->customerRegistry->expects($this->atLeastOnce())
1813+
->method('retrieveSecureData')
1814+
->willReturn($customerSecure);
1815+
$this->emailNotificationMock->expects($this->once())
1816+
->method('newAccount')
1817+
->willThrowException($exception);
1818+
$this->logger->expects($this->once())->method('error')->with($exception);
1819+
1820+
$this->accountManagement->createAccount($customer);
1821+
}
17241822
}

app/code/Magento/Email/Model/Template/Config.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,9 @@ public function getTemplateFilename($templateId, $designParams = [])
205205
$designParams['module'] = $module;
206206

207207
$file = $this->_getInfo($templateId, 'file');
208+
$filename = $this->getFilename($file, $designParams, $module);
208209

209-
return $this->viewFileSystem->getEmailTemplateFileName($file, $designParams, $module);
210+
return $filename;
210211
}
211212

212213
/**
@@ -230,4 +231,24 @@ protected function _getInfo($templateId, $fieldName)
230231
}
231232
return $data[$templateId][$fieldName];
232233
}
234+
235+
/**
236+
* @param string $file
237+
* @param array $designParams
238+
* @param string $module
239+
*
240+
* @return string
241+
*
242+
* @throws \UnexpectedValueException
243+
*/
244+
private function getFilename($file, array $designParams, $module)
245+
{
246+
$filename = $this->viewFileSystem->getEmailTemplateFileName($file, $designParams, $module);
247+
248+
if ($filename === false) {
249+
throw new \UnexpectedValueException("Template file '{$file}' is not found.");
250+
}
251+
252+
return $filename;
253+
}
233254
}

app/code/Magento/Email/Test/Unit/Model/Template/ConfigTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,19 @@ public function testGetTemplateFilenameWithNoParams()
272272
$this->assertEquals('_files/Fixture/ModuleOne/view/frontend/email/one.html', $actualResult);
273273
}
274274

275+
/**
276+
* @expectedException \UnexpectedValueException
277+
* @expectedExceptionMessage Template file 'one.html' is not found
278+
*/
279+
public function testGetTemplateFilenameWrongFileName()
280+
{
281+
$this->viewFileSystem->expects($this->once())->method('getEmailTemplateFileName')
282+
->with('one.html', $this->designParams, 'Fixture_ModuleOne')
283+
->willReturn(false);
284+
285+
$this->model->getTemplateFilename('template_one', $this->designParams);
286+
}
287+
275288
/**
276289
* @param string $getterMethod
277290
* @param $argument
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\NewRelicReporting\Console\Command;
7+
8+
use Symfony\Component\Console\Command\Command;
9+
use Symfony\Component\Console\Input\InputInterface;
10+
use Symfony\Component\Console\Output\OutputInterface;
11+
use Symfony\Component\Console\Input\InputArgument;
12+
use Magento\NewRelicReporting\Model\Apm\DeploymentsFactory;
13+
use Magento\NewRelicReporting\Model\ServiceShellUser;
14+
15+
class DeployMarker extends Command
16+
{
17+
/**
18+
* @var DeploymentsFactory
19+
*/
20+
private $deploymentsFactory;
21+
22+
/**
23+
* @var ServiceShellUser
24+
*/
25+
private $serviceShellUser;
26+
27+
/**
28+
* Initialize dependencies.
29+
*
30+
* @param DeploymentsFactory $deploymentsFactory
31+
* @param ServiceShellUser $serviceShellUser
32+
* @param null $name
33+
*/
34+
public function __construct(
35+
DeploymentsFactory $deploymentsFactory,
36+
ServiceShellUser $serviceShellUser,
37+
$name = null
38+
) {
39+
$this->deploymentsFactory = $deploymentsFactory;
40+
$this->serviceShellUser = $serviceShellUser;
41+
parent::__construct($name);
42+
}
43+
44+
/**
45+
* {@inheritdoc}
46+
*/
47+
protected function configure()
48+
{
49+
$this->setName("newrelic:create:deploy-marker");
50+
$this->setDescription("Check the deploy queue for entries and create an appropriate deploy marker.")
51+
->addArgument(
52+
'message',
53+
InputArgument::REQUIRED,
54+
'Deploy Message?'
55+
)
56+
->addArgument(
57+
'changelog',
58+
InputArgument::REQUIRED,
59+
'Change Log?'
60+
)
61+
->addArgument(
62+
'user',
63+
InputArgument::OPTIONAL,
64+
'Deployment User'
65+
);
66+
parent::configure();
67+
}
68+
69+
/**
70+
* {@inheritdoc}
71+
*/
72+
protected function execute(InputInterface $input, OutputInterface $output)
73+
{
74+
$this->deploymentsFactory->create()->setDeployment(
75+
$input->getArgument('message'),
76+
$input->getArgument('changelog'),
77+
$this->serviceShellUser->get($input->getArgument('user'))
78+
);
79+
$output->writeln('<info>NewRelic deployment information sent</info>');
80+
}
81+
}

app/code/Magento/NewRelicReporting/Model/Cron/ReportNewRelicCron.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ protected function reportCounts()
175175
public function report()
176176
{
177177
if ($this->config->isNewRelicEnabled()) {
178-
$this->reportModules();
179178
$this->reportCounts();
180179
}
181180

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\NewRelicReporting\Model;
7+
8+
class ServiceShellUser
9+
{
10+
/**
11+
* Default user name;
12+
*/
13+
const DEFAULT_USER = 'cron';
14+
15+
/**
16+
* Get use name.
17+
*
18+
* @param bool $userFromArgument
19+
* @return string
20+
*/
21+
public function get($userFromArgument = false)
22+
{
23+
if ($userFromArgument) {
24+
return $userFromArgument;
25+
}
26+
27+
$user = `echo \$USER`;
28+
if ($user) {
29+
return $user;
30+
}
31+
32+
return self::DEFAULT_USER;
33+
}
34+
}

0 commit comments

Comments
 (0)