Currency rates as entities (#3543)

This commit is contained in:
Yurii Kuznietsov
2025-12-13 10:31:07 +02:00
committed by GitHub
parent f46d9c8e4e
commit 0ee8d1dc91
72 changed files with 2518 additions and 127 deletions
@@ -37,15 +37,17 @@ use Espo\Core\Currency\Rates;
use Espo\Core\Field\Currency;
use Espo\Core\InjectableFactory;
use Espo\Core\Utils\Config\ConfigWriter;
use Espo\Tools\Currency\RecordManager;
use tests\integration\Core\BaseTestCase;
class CurrencyTest extends \tests\integration\Core\BaseTestCase
class CurrencyTest extends BaseTestCase
{
/**
* @noinspection PhpUnhandledExceptionInspection
*/
public function testSetCurrencyRates(): void
{
$app = $this->createApplication();
/** @var InjectableFactory $factory */
$factory = $app->getContainer()->get('injectableFactory');
$factory = $this->getInjectableFactory();
$configWriter = $factory->create(ConfigWriter::class);
@@ -55,8 +57,11 @@ class CurrencyTest extends \tests\integration\Core\BaseTestCase
$configWriter->set('currencyRates', [
'EUR' => 1.2,
]);
$configWriter->save();
$this->getInjectableFactory()->create(RecordManager::class)->sync();
$service = $factory->create(RateService::class);
$rates = Rates::fromAssoc(['EUR' => 1.3], '___');