Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

magento/magento2#21001 - fix unit tests, by passing currency to numbe… #21880

Merged
merged 3 commits into from
Mar 26, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions lib/internal/Magento/Framework/Locale/Test/Unit/FormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ protected function setUp()

/**
* @param string $localeCode
* @param string $currencyCode
* @param array $expectedResult
* @dataProvider getPriceFormatDataProvider
*/
public function testGetPriceFormat($localeCode, array $expectedResult): void
public function testGetPriceFormat($localeCode, $currencyCode, array $expectedResult): void
{
$this->scope->expects($this->once())
->method('getCurrentCurrency')
->willReturn($this->currency);

$this->currency->method('getCode')->willReturn($currencyCode);
$result = $this->formatModel->getPriceFormat($localeCode);
$intersection = array_intersect_assoc($result, $expectedResult);
$this->assertCount(count($expectedResult), $intersection);
Expand All @@ -89,17 +91,17 @@ public function testGetPriceFormat($localeCode, array $expectedResult): void
public function getPriceFormatDataProvider(): array
{
return [
['en_US', ['decimalSymbol' => '.', 'groupSymbol' => ',']],
['de_DE', ['decimalSymbol' => ',', 'groupSymbol' => '.']],
['de_CH', ['decimalSymbol' => '.', 'groupSymbol' => '\'']],
['uk_UA', ['decimalSymbol' => ',', 'groupSymbol' => ' ']]
['en_US', 'USD', ['decimalSymbol' => '.', 'groupSymbol' => ',']],
['de_DE', 'EUR', ['decimalSymbol' => ',', 'groupSymbol' => '.']],
['de_CH', 'CHF', ['decimalSymbol' => '.', 'groupSymbol' => '\'']],
['uk_UA', 'UAH', ['decimalSymbol' => ',', 'groupSymbol' => ' ']]
];
}

/**
*
* @param mixed $value
* @param float $expected
* @param mixed $value
* @param float $expected
* @dataProvider provideNumbers
*/
public function testGetNumber($value, $expected): void
Expand Down