Skip to content

Commit a91ff53

Browse files
Merge branch '2.4-develop' of github.com:magento-commerce/magento2ce into ACPT-488-ACPT-489-ACPT-490
2 parents c4ee5ee + e212168 commit a91ff53

File tree

20 files changed

+1008
-197
lines changed

20 files changed

+1008
-197
lines changed

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/CurrencyTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Directory\Model\Currency\DefaultLocator;
1313
use Magento\Directory\Model\CurrencyFactory;
1414
use Magento\Framework\App\RequestInterface;
15+
use Magento\Framework\Currency\Data\Currency as CurrencyData;
1516
use Magento\Framework\DataObject;
1617
use Magento\Framework\Locale\CurrencyInterface;
1718
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
@@ -123,7 +124,7 @@ public function testRenderWithDefaultCurrency()
123124
->method('getDefaultCurrency')
124125
->with($this->_requestMock)
125126
->willReturn('defaultCurrency');
126-
$currLocaleMock = $this->createMock(\Zend_Currency::class);
127+
$currLocaleMock = $this->createMock(CurrencyData::class);
127128
$currLocaleMock->expects($this->once())
128129
->method('toCurrency')
129130
->with(15.0000)

app/code/Magento/Bundle/Ui/DataProvider/Product/Modifier/SpecialPriceAttributes.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99

1010
use Magento\Bundle\Model\Product\Type;
1111
use Magento\Directory\Model\Currency as DirectoryCurrency;
12-
use Magento\Framework\Exception\NoSuchEntityException;
12+
use Magento\Framework\Currency\Data\Currency as CurrencyData;
1313
use Magento\Framework\Locale\ResolverInterface;
1414
use Magento\Ui\DataProvider\Modifier\ModifierInterface;
1515
use NumberFormatter;
16-
use Zend_Currency;
17-
use Zend_Currency_Exception;
1816

1917
/**
2018
* Modify product listing special price attributes
@@ -55,8 +53,6 @@ public function __construct(
5553

5654
/**
5755
* @inheritdoc
58-
* @throws NoSuchEntityException
59-
* @throws Zend_Currency_Exception
6056
*/
6157
public function modifyData(array $data): array
6258
{
@@ -74,7 +70,7 @@ public function modifyData(array $data): array
7470
$item[$priceAttribute] =
7571
$this->directoryCurrency->format(
7672
$item[$priceAttribute],
77-
['display' => Zend_Currency::NO_SYMBOL],
73+
['display' => CurrencyData::NO_SYMBOL],
7874
false
7975
);
8076
$item[$priceAttribute] = $numberFormatter->format($item[$priceAttribute] / 100);

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CurrencySymbolProviderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77

88
namespace Magento\Catalog\Test\Unit\Ui\DataProvider\Product\Form\Modifier;
99

10-
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\CurrencySymbolProvider;
1110
use Magento\Catalog\Model\Locator\LocatorInterface;
1211
use Magento\Catalog\Model\Product;
12+
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\CurrencySymbolProvider;
1313
use Magento\Directory\Model\Currency as CurrencyModel;
1414
use Magento\Framework\App\Config\ScopeConfigInterface;
15+
use Magento\Framework\Currency\Data\Currency as CurrencyData;
1516
use Magento\Framework\Locale\CurrencyInterface;
1617
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1718
use Magento\Store\Api\Data\StoreInterface;
1819
use Magento\Store\Api\Data\WebsiteInterface;
1920
use Magento\Store\Model\StoreManagerInterface;
2021
use PHPUnit\Framework\MockObject\MockObject;
2122
use PHPUnit\Framework\TestCase;
22-
use Zend_Currency;
2323

2424
/**
2525
* Test class for Website Currency Symbol provider
@@ -62,7 +62,7 @@ class CurrencySymbolProviderTest extends TestCase
6262
private $currencyMock;
6363

6464
/**
65-
* @var Zend_Currency|MockObject
65+
* @var CurrencyData|MockObject
6666
*/
6767
private $websiteCurrencyMock;
6868

@@ -103,7 +103,7 @@ protected function setUp(): void
103103
['getBaseCurrency']
104104
);
105105
$this->currencyMock = $this->createMock(CurrencyModel::class);
106-
$this->websiteCurrencyMock = $this->createMock(Zend_Currency::class);
106+
$this->websiteCurrencyMock = $this->createMock(CurrencyData::class);
107107
$this->productMock = $this->createMock(Product::class);
108108
$this->locatorMock = $this->getMockForAbstractClass(
109109
LocatorInterface::class,

app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProducts.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
use Magento\CatalogInventory\Api\StockRegistryInterface;
1414
use Magento\ConfigurableProduct\Model\Product\Type\Configurable as ConfigurableType;
1515
use Magento\ConfigurableProduct\Model\Product\Type\VariationMatrix;
16+
use Magento\Framework\App\ObjectManager;
17+
use Magento\Framework\Currency\Exception\CurrencyException;
18+
use Magento\Framework\Escaper;
1619
use Magento\Framework\Exception\NoSuchEntityException;
1720
use Magento\Framework\Json\Helper\Data as JsonHelper;
1821
use Magento\Framework\Locale\CurrencyInterface;
1922
use Magento\Framework\UrlInterface;
20-
use Magento\Framework\App\ObjectManager;
21-
use Magento\Framework\Escaper;
2223

2324
/**
2425
* Associated products helper
@@ -232,7 +233,7 @@ public function getConfigurableAttributesData()
232233
* Prepare variations
233234
*
234235
* @return void
235-
* @throws \Zend_Currency_Exception
236+
* @throws CurrencyException
236237
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
237238
* phpcs:disable Generic.Metrics.NestingLevel.TooHigh
238239
*/

app/code/Magento/Directory/Test/Unit/Model/CurrencyTest.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
use Magento\Directory\Model\Currency as CurrencyModel;
1111
use Magento\Framework\Currency;
12+
use Magento\Framework\Currency\Data\Currency as CurrencyData;
13+
use Magento\Framework\Currency\Exception\CurrencyException;
1214
use Magento\Framework\Locale\CurrencyInterface;
1315
use Magento\Framework\Locale\ResolverInterface as LocalResolverInterface;
1416
use Magento\Framework\NumberFormatterFactory;
@@ -207,32 +209,32 @@ public function getFormatTxtNumberFormatterDataProvider(): array
207209
['ar_AE', 'AED', '9', [], "\u{0669}\u{066B}\u{0660}\u{0660}\u{00A0}\u{062F}.\u{0625}.\u{200F}"],
208210
['de_DE', 'USD', '9999', [], "9.999,00\u{00A0}$"],
209211
['de_DE', 'EUR', '9999', [], "9.999,00\u{00A0}"],
210-
['en_US', 'USD', '9999', ['display' => Currency::NO_SYMBOL, 'precision' => 2], '9,999.00'],
211-
['en_US', 'USD', '9999', ['display' => Currency::NO_SYMBOL], '9,999.00'],
212-
['en_US', 'PLN', '9999', ['display' => Currency::NO_SYMBOL], '9,999.00'],
213-
['en_US', 'LBP', '9999', ['display' => Currency::NO_SYMBOL], '9,999'],
212+
['en_US', 'USD', '9999', ['display' => CurrencyData::NO_SYMBOL, 'precision' => 2], '9,999.00'],
213+
['en_US', 'USD', '9999', ['display' => CurrencyData::NO_SYMBOL], '9,999.00'],
214+
['en_US', 'PLN', '9999', ['display' => CurrencyData::NO_SYMBOL], '9,999.00'],
215+
['en_US', 'LBP', '9999', ['display' => CurrencyData::NO_SYMBOL], '9,999'],
214216
[
215217
'ar_AE',
216218
'USD',
217219
'9999',
218-
['display' => Currency::NO_SYMBOL],
220+
['display' => CurrencyData::NO_SYMBOL],
219221
"\u{0669}\u{066C}\u{0669}\u{0669}\u{0669}\u{066B}\u{0660}\u{0660}"
220222
],
221223
[
222224
'ar_AE',
223225
'AED',
224226
'9999',
225-
['display' => Currency::NO_SYMBOL],
227+
['display' => CurrencyData::NO_SYMBOL],
226228
"\u{0669}\u{066C}\u{0669}\u{0669}\u{0669}\u{066B}\u{0660}\u{0660}"
227229
],
228-
['en_US', 'USD', ' 9999', ['display' => Currency::NO_SYMBOL], '9,999.00'],
230+
['en_US', 'USD', ' 9999', ['display' => CurrencyData::NO_SYMBOL], '9,999.00'],
229231
['en_US', 'USD', '9999', ['precision' => 1], '$9,999.0'],
230232
['en_US', 'USD', '9999', ['precision' => 2, 'symbol' => '#'], '#9,999.00'],
231233
[
232234
'en_US',
233235
'USD',
234236
'9999.99',
235-
['precision' => 2, 'symbol' => '#', 'display' => Currency::NO_SYMBOL],
237+
['precision' => 2, 'symbol' => '#', 'display' => CurrencyData::NO_SYMBOL],
236238
'9,999.99'
237239
],
238240
];
@@ -243,15 +245,15 @@ public function getFormatTxtNumberFormatterDataProvider(): array
243245
* @param string $price
244246
* @param array $options
245247
* @param string $expected
246-
* @throws \Zend_Currency_Exception
248+
* @throws CurrencyException
247249
*/
248250
public function testFormatTxtWithZendCurrency(string $price, array $options, string $expected): void
249251
{
250252
$this->localeCurrencyMock
251253
->expects(self::once())
252254
->method('getCurrency')
253255
->with($this->currencyCode)
254-
->willReturn(new \Zend_Currency($options, 'en_US'));
256+
->willReturn(new CurrencyData($options, 'en_US'));
255257
$this->serializer->method('serialize')->willReturnMap(
256258
[
257259
[[], '[]']
@@ -273,7 +275,7 @@ public function getFormatTxtZendCurrencyDataProvider(): array
273275
['9999', ['display' => Currency::USE_SHORTNAME, 'foo' => 'bar'], 'USD9,999.00'],
274276
['9999', ['currency' => 'USD'], '$9,999.00'],
275277
['9999', ['currency' => 'CNY'], 'CN¥9,999.00'],
276-
['9999', ['locale' => 'fr_FR'], "9\u{00A0}999,00\u{00A0}$"]
278+
['9999', ['locale' => 'fr_FR'], "9\u{202F}999,00\u{00A0}$"]
277279
];
278280
}
279281
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class ValidationMessage
2020
/**
2121
* @var \Magento\Framework\Locale\CurrencyInterface
2222
* @deprecated 101.0.3 since 101.0.0
23+
* @see no alternatives
2324
*/
2425
private $currency;
2526

@@ -51,7 +52,6 @@ public function __construct(
5152
* Get validation message.
5253
*
5354
* @return \Magento\Framework\Phrase
54-
* @throws \Zend_Currency_Exception
5555
*/
5656
public function getMessage()
5757
{

app/code/Magento/Quote/Model/ValidationRules/MinimumAmountValidationRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public function __construct(
4848

4949
/**
5050
* @inheritdoc
51-
* @throws \Zend_Currency_Exception
5251
*/
5352
public function validate(Quote $quote): array
5453
{

app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Currency.php

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

88
namespace Magento\Reports\Block\Adminhtml\Grid\Column\Renderer;
99

10-
use Magento\Backend\Block\Widget\Grid\Column\Renderer\Currency as BackendCurrency;
1110
use Magento\Backend\Block\Context;
11+
use Magento\Backend\Block\Widget\Grid\Column\Renderer\Currency as BackendCurrency;
1212
use Magento\Directory\Model\Currency\DefaultLocator;
1313
use Magento\Directory\Model\CurrencyFactory;
14+
use Magento\Framework\Currency\Exception\CurrencyException;
1415
use Magento\Framework\DataObject;
1516
use Magento\Framework\Exception\LocalizedException;
1617
use Magento\Framework\Exception\NoSuchEntityException;
1718
use Magento\Framework\Locale\CurrencyInterface;
1819
use Magento\Store\Model\ScopeInterface;
1920
use Magento\Store\Model\Store;
2021
use Magento\Store\Model\StoreManagerInterface;
21-
use Zend_Currency_Exception;
2222

2323
/**
2424
* Adminhtml grid item renderer currency
@@ -70,7 +70,7 @@ public function __construct(
7070
* @return string
7171
* @throws LocalizedException
7272
* @throws NoSuchEntityException
73-
* @throws Zend_Currency_Exception
73+
* @throws CurrencyException
7474
*/
7575
public function render(DataObject $row)
7676
{
@@ -80,13 +80,10 @@ public function render(DataObject $row)
8080
if (!$currencyCode) {
8181
return $data;
8282
}
83-
8483
$rate = $this->getStoreCurrencyRate($currencyCode, $row);
85-
86-
$data = (float)$data * $rate;
87-
$data = sprintf("%f", $data);
88-
$data = $this->_localeCurrency->getCurrency($currencyCode)->toCurrency($data);
89-
return $data;
84+
$data = (float) $data * $rate;
85+
$data = sprintf('%f', $data);
86+
return $this->_localeCurrency->getCurrency($currencyCode)->toCurrency($data);
9087
}
9188

9289
/**

app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Grid/Column/Renderer/CurrencyTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use Magento\Directory\Model\Currency\DefaultLocator;
1313
use Magento\Directory\Model\CurrencyFactory;
1414
use Magento\Framework\App\Config\ScopeConfigInterface;
15+
use Magento\Framework\Currency\Data\Currency as CurrencyData;
16+
use Magento\Framework\Currency\Exception\CurrencyException;
1517
use Magento\Framework\DataObject;
1618
use Magento\Framework\Exception\LocalizedException;
1719
use Magento\Framework\Exception\NoSuchEntityException;
@@ -23,8 +25,6 @@
2325
use Magento\Store\Model\StoreManagerInterface;
2426
use PHPUnit\Framework\MockObject\MockObject;
2527
use PHPUnit\Framework\TestCase;
26-
use Zend_Currency;
27-
use Zend_Currency_Exception;
2828

2929
/**
3030
* Test for class Currency.
@@ -179,11 +179,11 @@ protected function setUp(): void
179179
* @param int $adminWebsiteId
180180
* @param string $adminCurrencyCode
181181
* @param string $storeCurrencyCode
182-
* @param float $adminOrderAmount
183-
* @param float $convertedAmount
182+
* @param string $adminOrderAmount
183+
* @param string $convertedAmount
184184
* @throws LocalizedException
185185
* @throws NoSuchEntityException
186-
* @throws Zend_Currency_Exception
186+
* @throws CurrencyException
187187
* @dataProvider getCurrencyDataProvider
188188
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
189189
*/
@@ -194,8 +194,8 @@ public function testRender(
194194
int $adminWebsiteId,
195195
string $adminCurrencyCode,
196196
string $storeCurrencyCode,
197-
float $adminOrderAmount,
198-
float $convertedAmount
197+
string $adminOrderAmount,
198+
string $convertedAmount
199199
): void {
200200
$this->row = new DataObject(
201201
[
@@ -240,7 +240,7 @@ public function testRender(
240240
->expects($this->any())
241241
->method('getDefaultCurrency')
242242
->willReturn($storeCurrencyCode);
243-
$currLocaleMock = $this->createMock(Zend_Currency::class);
243+
$currLocaleMock = $this->createMock(CurrencyData::class);
244244
$currLocaleMock
245245
->expects($this->any())
246246
->method('toCurrency')
@@ -271,8 +271,8 @@ public function getCurrencyDataProvider(): array
271271
'adminWebsiteId' => 1,
272272
'adminCurrencyCode' => 'EUR',
273273
'storeCurrencyCode' => 'EUR',
274-
'adminOrderAmount' => 105.00,
275-
'convertedAmount' => 105.00
274+
'adminOrderAmount' => '105.00',
275+
'convertedAmount' => '105.00'
276276
],
277277
'rate conversion with different admin and storefront rate' => [
278278
'rate' => 1.4150,
@@ -281,8 +281,8 @@ public function getCurrencyDataProvider(): array
281281
'adminWebsiteId' => 1,
282282
'adminCurrencyCode' => 'USD',
283283
'storeCurrencyCode' => 'EUR',
284-
'adminOrderAmount' => 105.00,
285-
'convertedAmount' => 148.575
284+
'adminOrderAmount' => '105.00',
285+
'convertedAmount' => '148.575'
286286
]
287287
];
288288
}

app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Adjustments.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
*/
66
namespace Magento\Sales\Block\Adminhtml\Order\Creditmemo\Create;
77

8+
use Magento\Framework\Currency\Data\Currency as CurrencyData;
89
use Magento\Framework\Pricing\PriceCurrencyInterface;
910
use Magento\Sales\Model\Order;
10-
use Zend_Currency;
1111

1212
/**
1313
* Credit memo adjustments block
@@ -25,8 +25,6 @@ class Adjustments extends \Magento\Backend\Block\Template
2525
protected $_source;
2626

2727
/**
28-
* Tax config
29-
*
3028
* @var \Magento\Tax\Model\Config
3129
*/
3230
protected $_taxConfig;
@@ -86,7 +84,7 @@ public function formatValue($value)
8684
return $order->getOrderCurrency()->formatPrecision(
8785
$value,
8886
2,
89-
['display' => Zend_Currency::NO_SYMBOL],
87+
['display' => CurrencyData::NO_SYMBOL],
9088
false,
9189
false
9290
);

0 commit comments

Comments
 (0)