@@ -26,28 +26,34 @@ class ValidationMessageTest extends \PHPUnit\Framework\TestCase
26
26
27
27
/**
28
28
* @var \PHPUnit_Framework_MockObject_MockObject
29
+ * @deprecated since 101.0.0
29
30
*/
30
31
private $ currencyMock ;
31
32
33
+ /**
34
+ * @var \PHPUnit_Framework_MockObject_MockObject
35
+ */
36
+ private $ priceHelperMock ;
37
+
32
38
protected function setUp ()
33
39
{
34
40
$ this ->scopeConfigMock = $ this ->createMock (\Magento \Framework \App \Config \ScopeConfigInterface::class);
35
41
$ this ->storeManagerMock = $ this ->createMock (\Magento \Store \Model \StoreManagerInterface::class);
36
42
$ this ->currencyMock = $ this ->createMock (\Magento \Framework \Locale \CurrencyInterface::class);
43
+ $ this ->priceHelperMock = $ this ->createMock (\Magento \Framework \Pricing \Helper \Data::class);
37
44
38
45
$ this ->model = new \Magento \Quote \Model \Quote \Validator \MinimumOrderAmount \ValidationMessage (
39
46
$ this ->scopeConfigMock ,
40
47
$ this ->storeManagerMock ,
41
- $ this ->currencyMock
48
+ $ this ->currencyMock ,
49
+ $ this ->priceHelperMock
42
50
);
43
51
}
44
52
45
53
public function testGetMessage ()
46
54
{
47
55
$ minimumAmount = 20 ;
48
56
$ minimumAmountCurrency = '$20 ' ;
49
- $ currencyCode = 'currency_code ' ;
50
-
51
57
$ this ->scopeConfigMock ->expects ($ this ->at (0 ))
52
58
->method ('getValue ' )
53
59
->with ('sales/minimum_order/description ' , \Magento \Store \Model \ScopeInterface::SCOPE_STORE )
@@ -58,27 +64,13 @@ public function testGetMessage()
58
64
->with ('sales/minimum_order/amount ' , \Magento \Store \Model \ScopeInterface::SCOPE_STORE )
59
65
->willReturn ($ minimumAmount );
60
66
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 ));
64
71
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 ());
80
73
}
81
-
82
74
public function testGetConfigMessage ()
83
75
{
84
76
$ configMessage = 'config_message ' ;
0 commit comments