@@ -20,20 +20,31 @@ class CurrencysymbolTest extends \PHPUnit\Framework\TestCase
2020 */
2121 protected $ currencySymbolModel ;
2222
23+ /**
24+ * @inheirtDoc
25+ */
2326 protected function setUp (): void
2427 {
2528 $ this ->currencySymbolModel = Bootstrap::getObjectManager ()->create (
2629 \Magento \CurrencySymbol \Model \System \Currencysymbol::class
2730 );
2831 }
2932
33+ /**
34+ * @inheirtDoc
35+ */
3036 protected function tearDown (): void
3137 {
3238 $ this ->currencySymbolModel = null ;
3339 Bootstrap::getObjectManager ()->get (\Magento \Framework \App \Config \ReinitableConfigInterface::class)->reinit ();
3440 Bootstrap::getObjectManager ()->create (\Magento \Store \Model \StoreManagerInterface::class)->reinitStores ();
3541 }
3642
43+ /**
44+ * Test that getCurrencySymbolsData method returns valid data
45+ *
46+ * @return void
47+ */
3748 public function testGetCurrencySymbolsData ()
3849 {
3950 $ currencySymbolsData = $ this ->currencySymbolModel ->getCurrencySymbolsData ();
@@ -80,8 +91,37 @@ public function testSetCurrencySymbolsData()
8091 $ this ->assertEquals ('@ ' , $ this ->currencySymbolModel ->getCurrencySymbol ('EUR ' ), 'Symbol not set correctly. ' );
8192 }
8293
94+ /**
95+ * Test that method returns valid data
96+ *
97+ * @return void
98+ */
8399 public function testGetCurrencySymbolNonExistent ()
84100 {
85101 $ this ->assertFalse ($ this ->currencySymbolModel ->getCurrencySymbol ('AUD ' ));
86102 }
103+
104+ /**
105+ * Test that default symbol can be set to use explicitly in the system
106+ *
107+ * @return void
108+ */
109+ public function testSetCurrencySymbolLikeParent ()
110+ {
111+ $ currencySymbolsData = ['USD ' => '$ ' ];
112+ $ this ->currencySymbolModel ->setCurrencySymbolsData ($ currencySymbolsData );
113+
114+ //Verify if the new symbol is set
115+ $ this ->assertEquals (
116+ '$ ' ,
117+ $ this ->currencySymbolModel ->getCurrencySymbolsData ()['USD ' ]['displaySymbol ' ],
118+ 'Symbol was not correctly set. '
119+ );
120+
121+ $ this ->assertEquals (
122+ false ,
123+ $ this ->currencySymbolModel ->getCurrencySymbolsData ()['USD ' ]['inherited ' ],
124+ 'Symbol \'s inheritance was not correctly set. '
125+ );
126+ }
87127}
0 commit comments