From f9724842cdb592a6ec0fcaf82ba25549338a5b99 Mon Sep 17 00:00:00 2001 From: zgrguric Date: Thu, 28 Mar 2024 16:02:43 +0100 Subject: [PATCH] [WIP] CurrencyConverter --- composer.json | 3 +- phpunit.xml.dist | 4 +-- src/Utilities/Util.php | 77 +++++++++++++++++++++++++++++++++++++++++ tests/Unit/UtilTest.php | 32 +++++++++++++++++ 4 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 src/Utilities/Util.php create mode 100644 tests/Unit/UtilTest.php diff --git a/composer.json b/composer.json index abc6fee..db29e67 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,8 @@ "brick/math": "^0.10.2|^0.11" }, "require-dev": { - "phpunit/phpunit": "^10.1" + "phpunit/phpunit": "^10.1", + "symfony/var-dumper": "^6.1" }, "scripts": { "test": "./vendor/bin/phpunit --testdox" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 213d863..7e823ce 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,8 +2,8 @@ - ./tests/Unit - ./tests/Feature + ./tests/Unit + diff --git a/src/Utilities/Util.php b/src/Utilities/Util.php new file mode 100644 index 0000000..8f09835 --- /dev/null +++ b/src/Utilities/Util.php @@ -0,0 +1,77 @@ +assertEquals('XAU (-0.5% pa)',Util::currencyToSymbol('0158415500000000C1F76FF6ECB0BAC600000000')); + + } + + public function testConvertCurrencyToSymbolISO() + { + $this->assertEquals('USD',Util::currencyToSymbol('USD')); + $this->assertEquals('EUR',Util::currencyToSymbol('EUR')); + $this->assertEquals('ABC',Util::currencyToSymbol('ABC')); + $this->assertEquals('000',Util::currencyToSymbol('000')); + $this->assertEquals('AB0',Util::currencyToSymbol('AB0')); + $this->assertEquals('123',Util::currencyToSymbol('123')); + } + + public function testConvertCurrencyToSymbolLP() + { + $this->assertEquals('LP 03B20F3A7D26D33C6DA3503E5CCE3E67B102D4D2',Util::currencyToSymbol('03B20F3A7D26D33C6DA3503E5CCE3E67B102D4D2')); + } + + +} \ No newline at end of file