Skip to content

Commit b96435f

Browse files
committed
#21001 - fix unit tests, by passing currency to number formatter, then it behaves as was expected in test.
1 parent 77297a1 commit b96435f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/internal/Magento/Framework/Locale/Test/Unit/FormatTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,17 @@ protected function setUp()
6868

6969
/**
7070
* @param string $localeCode
71+
* @param string $currencyCode
7172
* @param array $expectedResult
7273
* @dataProvider getPriceFormatDataProvider
7374
*/
74-
public function testGetPriceFormat($localeCode, array $expectedResult): void
75+
public function testGetPriceFormat($localeCode, $currencyCode, array $expectedResult): void
7576
{
7677
$this->scope->expects($this->once())
7778
->method('getCurrentCurrency')
7879
->willReturn($this->currency);
7980

81+
$this->currency->method('getCode')->willReturn($currencyCode);
8082
$result = $this->formatModel->getPriceFormat($localeCode);
8183
$intersection = array_intersect_assoc($result, $expectedResult);
8284
$this->assertCount(count($expectedResult), $intersection);
@@ -89,17 +91,17 @@ public function testGetPriceFormat($localeCode, array $expectedResult): void
8991
public function getPriceFormatDataProvider(): array
9092
{
9193
return [
92-
['en_US', ['decimalSymbol' => '.', 'groupSymbol' => ',']],
93-
['de_DE', ['decimalSymbol' => ',', 'groupSymbol' => '.']],
94-
['de_CH', ['decimalSymbol' => '.', 'groupSymbol' => '\'']],
95-
['uk_UA', ['decimalSymbol' => ',', 'groupSymbol' => ' ']]
94+
['en_US', 'USD', ['decimalSymbol' => '.', 'groupSymbol' => ',']],
95+
['de_DE', 'EUR', ['decimalSymbol' => ',', 'groupSymbol' => '.']],
96+
['de_CH', 'CHF', ['decimalSymbol' => '.', 'groupSymbol' => '']],
97+
['uk_UA', 'UAH', ['decimalSymbol' => ',', 'groupSymbol' => ' ']]
9698
];
9799
}
98100

99101
/**
100102
*
101-
* @param mixed $value
102-
* @param float $expected
103+
* @param mixed $value
104+
* @param float $expected
103105
* @dataProvider provideNumbers
104106
*/
105107
public function testGetNumber($value, $expected): void

0 commit comments

Comments
 (0)