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

Commit 8ded149

Browse files
MAGETWO-87531: [EngCom Team] Batch 27. Forwardports to 2.3-develop #1342
2 parents 0064e2b + 8007239 commit 8ded149

File tree

16 files changed

+167
-67
lines changed

16 files changed

+167
-67
lines changed

COPYING.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2013-2017 Magento, Inc.
1+
Copyright © 2013-2018 Magento, Inc.
22

33
Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license
44

app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ switch ($type = $block->getType()) {
146146
}
147147
break;
148148

149-
case 'other':
150-
break;
149+
default:
150+
$exist = null;
151151
}
152152
?>
153153

app/code/Magento/Customer/view/frontend/web/js/invalidation-processor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
2+
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
55
define([

app/code/Magento/Customer/view/frontend/web/js/invalidation-rules/website-rule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
2+
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
55
define([
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+
'change_log',
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('change_log'),
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+
}

app/code/Magento/NewRelicReporting/Test/Unit/Model/Cron/ReportNewRelicCronTest.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -144,24 +144,10 @@ public function testReportNewRelicCronModuleDisabledFromConfig()
144144
*/
145145
public function testReportNewRelicCron()
146146
{
147-
$testModuleData = [
148-
'changes' => [
149-
['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'enabled'],
150-
['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'disabled'],
151-
['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'installed'],
152-
['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'uninstalled'],
153-
],
154-
'enabled' => 1,
155-
'disabled' => 1,
156-
'installed' => 1,
157-
];
158147

159148
$this->config->expects($this->once())
160149
->method('isNewRelicEnabled')
161150
->willReturn(true);
162-
$this->collect->expects($this->once())
163-
->method('getModuleData')
164-
->willReturn($testModuleData);
165151
$this->counter->expects($this->once())
166152
->method('getAllProductsCount');
167153
$this->counter->expects($this->once())
@@ -198,24 +184,10 @@ public function testReportNewRelicCron()
198184
*/
199185
public function testReportNewRelicCronRequestFailed()
200186
{
201-
$testModuleData = [
202-
'changes' => [
203-
['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'enabled'],
204-
['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'disabled'],
205-
['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'installed'],
206-
['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'uninstalled'],
207-
],
208-
'enabled' => 1,
209-
'disabled' => 1,
210-
'installed' => 1,
211-
];
212187

213188
$this->config->expects($this->once())
214189
->method('isNewRelicEnabled')
215190
->willReturn(true);
216-
$this->collect->expects($this->once())
217-
->method('getModuleData')
218-
->willReturn($testModuleData);
219191
$this->counter->expects($this->once())
220192
->method('getAllProductsCount');
221193
$this->counter->expects($this->once())

app/code/Magento/NewRelicReporting/etc/di.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@
3030
<type name="Magento\Framework\App\Http">
3131
<plugin name="framework-http-newrelic" type="Magento\NewRelicReporting\Plugin\HttpPlugin"/>
3232
</type>
33+
<type name="Magento\Framework\Console\CommandListInterface">
34+
<arguments>
35+
<argument name="commands" xsi:type="array">
36+
<item name="newrelicreporting_deploy_marker" xsi:type="object">Magento\NewRelicReporting\Console\Command\DeployMarker</item>
37+
</argument>
38+
</arguments>
39+
</type>
3340
</config>

app/code/Magento/Quote/Model/Quote/Validator/MinimumOrderAmount/ValidationMessage.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,32 @@ class ValidationMessage
1919

2020
/**
2121
* @var \Magento\Framework\Locale\CurrencyInterface
22+
* @deprecated since 101.0.0
2223
*/
2324
private $currency;
2425

26+
/**
27+
* @var \Magento\Framework\Pricing\Helper\Data
28+
*/
29+
private $priceHelper;
30+
2531
/**
2632
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
2733
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
2834
* @param \Magento\Framework\Locale\CurrencyInterface $currency
35+
* @param \Magento\Framework\Pricing\Helper\Data $priceHelper
2936
*/
3037
public function __construct(
3138
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
3239
\Magento\Store\Model\StoreManagerInterface $storeManager,
33-
\Magento\Framework\Locale\CurrencyInterface $currency
40+
\Magento\Framework\Locale\CurrencyInterface $currency,
41+
\Magento\Framework\Pricing\Helper\Data $priceHelper = null
3442
) {
3543
$this->scopeConfig = $scopeConfig;
3644
$this->storeManager = $storeManager;
3745
$this->currency = $currency;
46+
$this->priceHelper = $priceHelper ?: \Magento\Framework\App\ObjectManager::getInstance()
47+
->get(\Magento\Framework\Pricing\Helper\Data::class);
3848
}
3949

4050
/**
@@ -50,13 +60,11 @@ public function getMessage()
5060
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
5161
);
5262
if (!$message) {
53-
$currencyCode = $this->storeManager->getStore()->getCurrentCurrencyCode();
54-
$minimumAmount = $this->currency->getCurrency($currencyCode)->toCurrency(
55-
$this->scopeConfig->getValue(
56-
'sales/minimum_order/amount',
57-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
58-
)
59-
);
63+
$minimumAmount = $this->priceHelper->currency($this->scopeConfig->getValue(
64+
'sales/minimum_order/amount',
65+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
66+
), true, false);
67+
6068
$message = __('Minimum order amount is %1', $minimumAmount);
6169
} else {
6270
//Added in order to address the issue: https://github.com/magento/magento2/issues/8287

0 commit comments

Comments
 (0)