Skip to content

Commit 72374dc

Browse files
authored
ENGCOM-4554: #21001 - fix unit tests, by passing currency to numbe… #21880
2 parents 44a415d + 563d6ec commit 72374dc

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

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

Lines changed: 10 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);
@@ -88,18 +90,19 @@ public function testGetPriceFormat($localeCode, array $expectedResult): void
8890
*/
8991
public function getPriceFormatDataProvider(): array
9092
{
93+
$swissGroupSymbol = INTL_ICU_VERSION >= 59.1 ? '' : '\'';
9194
return [
92-
['en_US', ['decimalSymbol' => '.', 'groupSymbol' => ',']],
93-
['de_DE', ['decimalSymbol' => ',', 'groupSymbol' => '.']],
94-
['de_CH', ['decimalSymbol' => '.', 'groupSymbol' => '\'']],
95-
['uk_UA', ['decimalSymbol' => ',', 'groupSymbol' => ' ']]
95+
['en_US', 'USD', ['decimalSymbol' => '.', 'groupSymbol' => ',']],
96+
['de_DE', 'EUR', ['decimalSymbol' => ',', 'groupSymbol' => '.']],
97+
['de_CH', 'CHF', ['decimalSymbol' => '.', 'groupSymbol' => $swissGroupSymbol]],
98+
['uk_UA', 'UAH', ['decimalSymbol' => ',', 'groupSymbol' => ' ']]
9699
];
97100
}
98101

99102
/**
100103
*
101-
* @param mixed $value
102-
* @param float $expected
104+
* @param mixed $value
105+
* @param float $expected
103106
* @dataProvider provideNumbers
104107
*/
105108
public function testGetNumber($value, $expected): void

0 commit comments

Comments
 (0)