#[Package('buyers-experience')]
class CurrencyFormatterTest extends TestCase
{ private MockObject&LanguageLocaleCodeProvider
$localeProvider;
private CurrencyFormatter
$formatter;
protected function setUp(): void
{ $this->localeProvider =
static::
createMock(LanguageLocaleCodeProvider::
class);
$this->formatter =
new CurrencyFormatter($this->localeProvider
);
} /**
* @dataProvider formattingParameterProvider
*/
public function testFormatCurrencyByLanguageWillUseProvidedDecimalPlaces(float
$price, int
$decimalPlaces, string
$localeCode, string
$expectedSeparator, string
$currencyISO): void
{ $this->localeProvider->
expects(static::
once())->
method('getLocaleForLanguageId'
)->
willReturn($localeCode);
$pattern =
sprintf('/\%s\d{%s}/',
$expectedSeparator,
(string) $decimalPlaces);
$formattedPrice =
$this->formatter->
formatCurrencyByLanguage( $price,