get(CurrencyContext::class); $this->assertEquals('26.17', $context->getSupported()['EUR']->getRate()->asFloat()); } public function testForeignCurrencyCNBTest() { $dbcfg = Settings::getDefault(); $dbcfg->currency = 'EUR'; $this->tearDownContainer(); /** @var CurrencyContext $context */ $context = $this->get(CurrencyContext::class); $context->getSupported()['EUR']->setRate(toDecimal(1.02)); $context->getSupported()['CZK']->setRate(toDecimal(0.0380)); $context->getSupported()['CZK']->setSync('Y'); CNB::setUrl(__DIR__.'/CNBTest.txt'); CNB::updateSharedCurrencies(); CNB::updateCurrencies(); $context = $this->get(CurrencyContext::class); $this->assertEquals('1', $context->getSupported()['EUR']->getRate()->asFloat()); $this->assertEqualsWithDelta(0.03821169277799, $context->getSupported()['CZK']->getRate()->asFloat(), 0.00000000000001); } public function testCNBCorrections() { /** @var CurrencyContext $context */ $context = $this->get(CurrencyContext::class); $context->getSupported()['EUR']->setCorrections(toDecimal(0.83)); CNB::setUrl(__DIR__.'/CNBTest.txt'); CNB::updateSharedCurrencies(); CNB::updateCurrencies(true); $this->assertEquals('27', $context->getSupported()['EUR']->getRate()->asFloat()); } }