public function testGetOptionCurrencies() { $locale = new \Magento\Framework\Locale('en'); $this->mockLocaleResolver->expects($this->exactly(2))->method('getLocale')->will($this->returnValue($locale)); $allowedCurrencies = ['USD', 'GBP', 'EUR']; $this->mockConfig->expects($this->once())->method('getAllowedCurrencies')->will($this->returnValue($allowedCurrencies)); $expectedArray = [['value' => 'GBP', 'label' => 'British Pound Sterling'], ['value' => 'EUR', 'label' => 'Euro'], ['value' => 'USD', 'label' => 'US Dollar']]; $this->assertSame($expectedArray, $this->listsModel->getOptionCurrencies()); }
public function testGetOptionCurrencies() { $allowedCurrencies = ['USD', 'EUR', 'GBP', 'UAH']; $this->mockConfig->expects($this->once())->method('getAllowedCurrencies')->will($this->returnValue($allowedCurrencies)); $expectedResults = ['USD', 'EUR', 'GBP', 'UAH']; $currencyList = $this->listsModel->getOptionCurrencies(); foreach ($expectedResults as $value) { $found = false; foreach ($currencyList as $item) { $found = $found || $value == $item['value']; } $this->assertTrue($found); } }