Skip to content

Commit aaecf00

Browse files
authored
Merge pull request #52 from magento-commerce/develop
MCLOUD-8486: Release Cloud Tools
2 parents 5a4d952 + 77a07d1 commit aaecf00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+318
-81
lines changed

.github/.metadata.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"templateVersion": "0.1",
3+
"product": {
4+
"name": "Magento Cloud Patches",
5+
"description": "The Magento Cloud Patches package is a set of patches, previously used within the ece-tools package to improve the integration of all Magento versions with Cloud environments and to deliver critical fixes quickly"
6+
},
7+
"contacts": {
8+
"team": {
9+
"name": "Magic Mountain",
10+
"DL": "Grp-magento-cloud-all",
11+
"slackChannel": "magic_mountain"
12+
}
13+
},
14+
"ticketTracker": {
15+
"functionalJiraQueue": {
16+
"projectKey": "MCLOUD"
17+
},
18+
"securityJiraQueue": {
19+
"projectKey": "MAGREQ",
20+
"component": "Magento Cloud Engineering"
21+
}
22+
},
23+
"staticScan": {
24+
"enable": false
25+
}
26+
}

composer.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento-cloud-patches",
33
"description": "Provides critical fixes for Magento 2 Enterprise Edition",
44
"type": "magento2-component",
5-
"version": "1.0.14",
5+
"version": "1.0.15",
66
"license": "OSL-3.0",
77
"repositories": {
88
"repo.magento.com": {
@@ -11,7 +11,7 @@
1111
}
1212
},
1313
"require": {
14-
"php": "^7.0",
14+
"php": "^7.2 || ^8.0",
1515
"ext-json": "*",
1616
"composer/composer": "@stable",
1717
"composer/semver": "@stable",
@@ -25,10 +25,14 @@
2525
"magento/quality-patches": "^1.1.0"
2626
},
2727
"require-dev": {
28-
"codeception/codeception": "^2.5.3",
28+
"codeception/codeception": "^4.1",
29+
"codeception/module-asserts": "^1.2",
30+
"codeception/module-db": "^1.0",
31+
"codeception/module-phpbrowser": "^1.0",
32+
"codeception/module-rest": "^1.2",
2933
"consolidation/robo": "^1.2",
3034
"phpmd/phpmd": "@stable",
31-
"phpunit/phpunit": "^7.2",
35+
"phpunit/phpunit": "^8.5 || ^9.5",
3236
"squizlabs/php_codesniffer": "^3.0"
3337
},
3438
"bin": [

patches.json

+3
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@
260260
"Incompatible PHP Method Fix": {
261261
"2.3.7-p1": "AC-384__Fix_Incompatible_PHP_Method__2.3.7-p1_ce.patch",
262262
"2.4.3": "AC-384__Fix_Incompatible_PHP_Method__2.4.3_ce.patch"
263+
},
264+
"Fixed currency displaying on product page": {
265+
">=2.4.3 <2.4.4": "MCLOUD-8279__Fixed_currency_displaying_on_product_page__2.4.3.patch"
263266
}
264267
},
265268
"magento/module-paypal": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
diff -Nuar a/vendor/magento/module-directory/Model/Currency.php b/vendor/magento/module-directory/Model/Currency.php
2+
index 65b47d7535c..e1815b25619 100644
3+
--- a/vendor/magento/module-directory/Model/Currency.php
4+
+++ b/vendor/magento/module-directory/Model/Currency.php
5+
@@ -13,6 +13,7 @@ use Magento\Framework\Locale\Currency as LocaleCurrency;
6+
use Magento\Framework\Locale\ResolverInterface as LocalResolverInterface;
7+
use Magento\Framework\NumberFormatterFactory;
8+
use Magento\Framework\Serialize\Serializer\Json;
9+
+use Magento\Framework\Exception\LocalizedException;
10+
11+
/**
12+
* Currency model
13+
@@ -39,8 +40,6 @@ class Currency extends \Magento\Framework\Model\AbstractModel
14+
protected $_filter;
15+
16+
/**
17+
- * Currency Rates
18+
- *
19+
* @var array
20+
*/
21+
protected $_rates;
22+
@@ -147,11 +146,14 @@ class Currency extends \Magento\Framework\Model\AbstractModel
23+
$this->_localeCurrency = $localeCurrency;
24+
$this->currencyConfig = $currencyConfig ?: ObjectManager::getInstance()->get(CurrencyConfig::class);
25+
$this->localeResolver = $localeResolver ?: ObjectManager::getInstance()->get(LocalResolverInterface::class);
26+
- $this->numberFormatterFactory = $numberFormatterFactory ?: ObjectManager::getInstance()->get(NumberFormatterFactory::class);
27+
+ $this->numberFormatterFactory = $numberFormatterFactory ?:
28+
+ ObjectManager::getInstance()->get(NumberFormatterFactory::class);
29+
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
30+
}
31+
32+
/**
33+
+ * Initializing Currency Resource model
34+
+ *
35+
* @return void
36+
*/
37+
protected function _construct()
38+
@@ -253,10 +255,10 @@ class Currency extends \Magento\Framework\Model\AbstractModel
39+
/**
40+
* Convert price to currency format
41+
*
42+
- * @param float $price
43+
- * @param mixed $toCurrency
44+
- * @return float
45+
- * @throws \Exception
46+
+ * @param float $price
47+
+ * @param mixed $toCurrency
48+
+ * @return float
49+
+ * @throws LocalizedException
50+
*/
51+
public function convert($price, $toCurrency = null)
52+
{
53+
@@ -266,7 +268,7 @@ class Currency extends \Magento\Framework\Model\AbstractModel
54+
return (float)$price * (float)$rate;
55+
}
56+
57+
- throw new \Exception(__(
58+
+ throw new LocalizedException(__(
59+
'Undefined rate from "%1-%2".',
60+
$this->getCode(),
61+
$this->getCurrencyCodeFromToCurrency($toCurrency)
62+
@@ -274,7 +276,10 @@ class Currency extends \Magento\Framework\Model\AbstractModel
63+
}
64+
65+
/**
66+
+ * Return the currency code
67+
+ *
68+
* @param mixed $toCurrency
69+
+ *
70+
* @return string
71+
* @throws \Magento\Framework\Exception\InputException
72+
*/
73+
@@ -348,8 +353,11 @@ class Currency extends \Magento\Framework\Model\AbstractModel
74+
}
75+
76+
/**
77+
+ * Return formatted currency
78+
+ *
79+
* @param float $price
80+
* @param array $options
81+
+ *
82+
* @return string
83+
*/
84+
public function formatTxt($price, $options = [])
85+
@@ -420,7 +428,8 @@ class Currency extends \Magento\Framework\Model\AbstractModel
86+
$this->numberFormatter = $this->getNumberFormatter($options);
87+
88+
$formattedCurrency = $this->numberFormatter->formatCurrency(
89+
- $price, $this->getCode() ?? $this->numberFormatter->getTextAttribute(\NumberFormatter::CURRENCY_CODE)
90+
+ $price,
91+
+ $this->getCode() ?? $this->numberFormatter->getTextAttribute(\NumberFormatter::CURRENCY_CODE)
92+
);
93+
94+
if (array_key_exists(LocaleCurrency::CURRENCY_OPTION_SYMBOL, $options)) {
95+
@@ -430,7 +439,7 @@ class Currency extends \Magento\Framework\Model\AbstractModel
96+
97+
if ((array_key_exists(LocaleCurrency::CURRENCY_OPTION_DISPLAY, $options)
98+
&& $options[LocaleCurrency::CURRENCY_OPTION_DISPLAY] === \Magento\Framework\Currency::NO_SYMBOL)) {
99+
- $formattedCurrency = str_replace(' ', '', $formattedCurrency);
100+
+ $formattedCurrency = preg_replace(['/[^0-9.,۰٫]+/', '/ /'], '', $formattedCurrency);
101+
}
102+
103+
return preg_replace('/^\s+|\s+$/u', '', $formattedCurrency);
104+
@@ -444,7 +453,10 @@ class Currency extends \Magento\Framework\Model\AbstractModel
105+
*/
106+
private function getNumberFormatter(array $options): \Magento\Framework\NumberFormatter
107+
{
108+
- $key = 'currency_' . md5($this->localeResolver->getLocale() . $this->serializer->serialize($options));
109+
+ $key = 'currency_' . hash(
110+
+ 'sha256',
111+
+ ($this->localeResolver->getLocale() . $this->serializer->serialize($options))
112+
+ );
113+
if (!isset($this->numberFormatterCache[$key])) {
114+
$this->numberFormatter = $this->numberFormatterFactory->create(
115+
['locale' => $this->localeResolver->getLocale(), 'style' => \NumberFormatter::CURRENCY]
116+
@@ -467,7 +479,8 @@ class Currency extends \Magento\Framework\Model\AbstractModel
117+
{
118+
if (array_key_exists(LocaleCurrency::CURRENCY_OPTION_SYMBOL, $options)) {
119+
$this->numberFormatter->setSymbol(
120+
- \NumberFormatter::CURRENCY_SYMBOL, $options[LocaleCurrency::CURRENCY_OPTION_SYMBOL]
121+
+ \NumberFormatter::CURRENCY_SYMBOL,
122+
+ $options[LocaleCurrency::CURRENCY_OPTION_SYMBOL]
123+
);
124+
}
125+
if (array_key_exists(LocaleCurrency::CURRENCY_OPTION_DISPLAY, $options)
126+
@@ -490,6 +503,8 @@ class Currency extends \Magento\Framework\Model\AbstractModel
127+
}
128+
129+
/**
130+
+ * Return the price format to be displayed to user
131+
+ *
132+
* @return string
133+
*/
134+
public function getOutputFormat()
135+
@@ -532,6 +547,8 @@ class Currency extends \Magento\Framework\Model\AbstractModel
136+
}
137+
138+
/**
139+
+ * Retrieve base config currency data by config path.
140+
+ *
141+
* @return array
142+
*/
143+
public function getConfigBaseCurrencies()

src/Test/Functional/Acceptance/AbstractCest.php

+13-15
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,26 @@ protected function prepareTemplate(\CliTester $I, string $templateVersion, strin
3737
$I->createArtifactsDir();
3838
$I->createArtifactCurrentTestedCode('patches', '1.0.99');
3939
$I->addArtifactsRepoToComposer();
40+
$I->addDependencyToComposer('magento/magento-cloud-patches', '1.0.99');
41+
4042
$I->addEceDockerGitRepoToComposer();
4143
$I->addQualityPatchesGitRepoToComposer();
4244
$I->addEceToolsGitRepoToComposer();
4345
$I->addCloudComponentsGitRepoToComposer();
44-
$I->addDependencyToComposer('magento/magento-cloud-patches', '1.0.99');
45-
$I->addDependencyToComposer(
46-
'magento/magento-cloud-docker',
47-
$I->getDependencyVersion('magento/magento-cloud-docker')
48-
);
49-
$I->addDependencyToComposer(
50-
'magento/quality-patches',
51-
$I->getDependencyVersion('magento/quality-patches')
52-
);
5346

54-
$I->addDependencyToComposer(
47+
$dependencies = [
48+
'magento/magento-cloud-docker',
5549
'magento/magento-cloud-components',
56-
$I->getDependencyVersion('magento/magento-cloud-components')
57-
);
58-
$I->addDependencyToComposer(
50+
'magento/quality-patches',
5951
'magento/ece-tools',
60-
$I->getDependencyVersion('magento/ece-tools')
61-
);
52+
];
53+
54+
foreach ($dependencies as $dependency) {
55+
$I->assertTrue(
56+
$I->addDependencyToComposer($dependency, $I->getDependencyVersion($dependency)),
57+
'Can not add dependency ' . $dependency
58+
);
59+
}
6260

6361
if ($this->edition === 'CE' || $magentoVersion) {
6462
$version = $magentoVersion ?: $this->getVersionRangeForMagento($I);

src/Test/Functional/Acceptance/Acceptance73Cest.php

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ protected function patchesDataProvider(): array
2929
['templateVersion' => '2.3.6', 'magentoVersion' => '2.3.6-p1'],
3030
['templateVersion' => '2.3.7', 'magentoVersion' => '2.3.7'],
3131
['templateVersion' => '2.3.7', 'magentoVersion' => '2.3.7-p1'],
32+
['templateVersion' => '2.3.7', 'magentoVersion' => '2.3.7-p2'],
3233
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0'],
3334
];
3435
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CloudPatches\Test\Functional\Acceptance;
9+
10+
/**
11+
* @group php74ce
12+
*/
13+
class Acceptance74CeCest extends Acceptance74Cest
14+
{
15+
/**
16+
* @var string
17+
*/
18+
protected $edition = 'CE';
19+
20+
/**
21+
* @return array
22+
*/
23+
protected function patchesDataProvider(): array
24+
{
25+
return [
26+
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0'],
27+
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0-p1'],
28+
['templateVersion' => '2.4.1', 'magentoVersion' => '2.4.1'],
29+
['templateVersion' => '2.4.1', 'magentoVersion' => '2.4.1-p1'],
30+
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2'],
31+
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2-p1'],
32+
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2-p2'],
33+
// Magento 2.4.3 CE does not work on the cloud
34+
// ['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3'],
35+
// ['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3-p1'],
36+
];
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CloudPatches\Test\Functional\Acceptance;
9+
10+
/**
11+
* @group php74
12+
*/
13+
class Acceptance74Cest extends AcceptanceCest
14+
{
15+
/**
16+
* @return array
17+
*/
18+
protected function patchesDataProvider(): array
19+
{
20+
return [
21+
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0'],
22+
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0-p1'],
23+
['templateVersion' => '2.4.1', 'magentoVersion' => '2.4.1'],
24+
['templateVersion' => '2.4.1', 'magentoVersion' => '2.4.1-p1'],
25+
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2'],
26+
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2-p1'],
27+
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2-p2'],
28+
['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3'],
29+
['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3-p1'],
30+
];
31+
}
32+
}

src/Test/Functional/Acceptance/AcceptanceCeCest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace Magento\CloudPatches\Test\Functional\Acceptance;
99

1010
/**
11-
* @group php74ce
11+
* @group php81ce
1212
*/
1313
class AcceptanceCeCest extends AcceptanceCest
1414
{

src/Test/Functional/Acceptance/AcceptanceCest.php

+2-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace Magento\CloudPatches\Test\Functional\Acceptance;
99

1010
/**
11-
* @group php74
11+
* @group php81
1212
*/
1313
class AcceptanceCest extends AbstractCest
1414
{
@@ -49,15 +49,7 @@ public function testPatches(\CliTester $I, \Codeception\Example $data): void
4949
protected function patchesDataProvider(): array
5050
{
5151
return [
52-
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0'],
53-
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0-p1'],
54-
['templateVersion' => '2.4.1', 'magentoVersion' => '2.4.1'],
55-
['templateVersion' => '2.4.1', 'magentoVersion' => '2.4.1-p1'],
56-
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2'],
57-
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2-p1'],
58-
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2-p2'],
59-
['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3'],
60-
['templateVersion' => 'master'],
52+
['templateVersion' => '2.4.4'],
6153
];
6254
}
6355
}

0 commit comments

Comments
 (0)