@@ -26,28 +26,34 @@ class ValidationMessageTest extends \PHPUnit\Framework\TestCase
2626
2727 /**
2828 * @var \PHPUnit_Framework_MockObject_MockObject
29+ * @deprecated since 101.0.0
2930 */
3031 private $ currencyMock ;
3132
33+ /**
34+ * @var \PHPUnit_Framework_MockObject_MockObject
35+ */
36+ private $ priceHelperMock ;
37+
3238 protected function setUp ()
3339 {
3440 $ this ->scopeConfigMock = $ this ->createMock (\Magento \Framework \App \Config \ScopeConfigInterface::class);
3541 $ this ->storeManagerMock = $ this ->createMock (\Magento \Store \Model \StoreManagerInterface::class);
3642 $ this ->currencyMock = $ this ->createMock (\Magento \Framework \Locale \CurrencyInterface::class);
43+ $ this ->priceHelperMock = $ this ->createMock (\Magento \Framework \Pricing \Helper \Data::class);
3744
3845 $ this ->model = new \Magento \Quote \Model \Quote \Validator \MinimumOrderAmount \ValidationMessage (
3946 $ this ->scopeConfigMock ,
4047 $ this ->storeManagerMock ,
41- $ this ->currencyMock
48+ $ this ->currencyMock ,
49+ $ this ->priceHelperMock
4250 );
4351 }
4452
4553 public function testGetMessage ()
4654 {
4755 $ minimumAmount = 20 ;
4856 $ minimumAmountCurrency = '$20 ' ;
49- $ currencyCode = 'currency_code ' ;
50-
5157 $ this ->scopeConfigMock ->expects ($ this ->at (0 ))
5258 ->method ('getValue ' )
5359 ->with ('sales/minimum_order/description ' , \Magento \Store \Model \ScopeInterface::SCOPE_STORE )
@@ -58,27 +64,13 @@ public function testGetMessage()
5864 ->with ('sales/minimum_order/amount ' , \Magento \Store \Model \ScopeInterface::SCOPE_STORE )
5965 ->willReturn ($ minimumAmount );
6066
61- $ storeMock = $ this ->createPartialMock (\Magento \Store \Model \Store::class, ['getCurrentCurrencyCode ' ]);
62- $ storeMock ->expects ($ this ->once ())->method ('getCurrentCurrencyCode ' )->willReturn ($ currencyCode );
63- $ this ->storeManagerMock ->expects ($ this ->once ())->method ('getStore ' )->willReturn ($ storeMock );
67+ $ this ->priceHelperMock ->expects ($ this ->once ())
68+ ->method ('currency ' )
69+ ->with ($ minimumAmount , true , false )
70+ ->will ($ this ->returnValue ($ minimumAmountCurrency ));
6471
65- $ currencyMock = $ this ->createMock (\Magento \Framework \Currency::class);
66- $ this ->currencyMock ->expects ($ this ->once ())
67- ->method ('getCurrency ' )
68- ->with ($ currencyCode )
69- ->willReturn ($ currencyMock );
70-
71- $ currencyMock ->expects ($ this ->once ())
72- ->method ('toCurrency ' )
73- ->with ($ minimumAmount )
74- ->willReturn ($ minimumAmountCurrency );
75-
76- $ this ->assertEquals (
77- __ ('Minimum order amount is %1 ' , $ minimumAmountCurrency ),
78- $ this ->model ->getMessage ()
79- );
72+ $ this ->assertEquals (__ ('Minimum order amount is %1 ' , $ minimumAmountCurrency ), $ this ->model ->getMessage ());
8073 }
81-
8274 public function testGetConfigMessage ()
8375 {
8476 $ configMessage = 'config_message ' ;
0 commit comments