@@ -20,20 +20,31 @@ class CurrencysymbolTest extends \PHPUnit\Framework\TestCase
20
20
*/
21
21
protected $ currencySymbolModel ;
22
22
23
+ /**
24
+ * @inheirtDoc
25
+ */
23
26
protected function setUp (): void
24
27
{
25
28
$ this ->currencySymbolModel = Bootstrap::getObjectManager ()->create (
26
29
\Magento \CurrencySymbol \Model \System \Currencysymbol::class
27
30
);
28
31
}
29
32
33
+ /**
34
+ * @inheirtDoc
35
+ */
30
36
protected function tearDown (): void
31
37
{
32
38
$ this ->currencySymbolModel = null ;
33
39
Bootstrap::getObjectManager ()->get (\Magento \Framework \App \Config \ReinitableConfigInterface::class)->reinit ();
34
40
Bootstrap::getObjectManager ()->create (\Magento \Store \Model \StoreManagerInterface::class)->reinitStores ();
35
41
}
36
42
43
+ /**
44
+ * Test that getCurrencySymbolsData method returns valid data
45
+ *
46
+ * @return void
47
+ */
37
48
public function testGetCurrencySymbolsData ()
38
49
{
39
50
$ currencySymbolsData = $ this ->currencySymbolModel ->getCurrencySymbolsData ();
@@ -80,8 +91,37 @@ public function testSetCurrencySymbolsData()
80
91
$ this ->assertEquals ('@ ' , $ this ->currencySymbolModel ->getCurrencySymbol ('EUR ' ), 'Symbol not set correctly. ' );
81
92
}
82
93
94
+ /**
95
+ * Test that method returns valid data
96
+ *
97
+ * @return void
98
+ */
83
99
public function testGetCurrencySymbolNonExistent ()
84
100
{
85
101
$ this ->assertFalse ($ this ->currencySymbolModel ->getCurrencySymbol ('AUD ' ));
86
102
}
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
+ }
87
127
}
0 commit comments