@@ -46,42 +46,38 @@ public function testToHtml($requestParamMap)
46
46
'revertDesign '
47
47
])
48
48
->disableOriginalConstructor ()
49
- ->getMock ()
50
- ;
49
+ ->getMock ();
51
50
$ template ->expects ($ this ->once ())
52
51
->method ('getProcessedTemplate ' )
53
52
->with ($ this ->equalTo ([]))
54
- ->will ($ this ->returnValue (self ::MALICIOUS_TEXT ));
55
- $ designConfigData = [
56
- 'area ' => \Magento \Framework \App \Area::AREA_FRONTEND ,
57
- 'store ' => $ storeId
58
- ];
53
+ ->willReturn (self ::MALICIOUS_TEXT );
54
+ $ designConfigData = [];
59
55
$ template ->expects ($ this ->atLeastOnce ())
60
56
->method ('getDesignConfig ' )
61
- ->will ( $ this -> returnValue (new \Magento \Framework \DataObject (
57
+ ->willReturn (new \Magento \Framework \DataObject (
62
58
$ designConfigData
63
- ))) ;
59
+ ));
64
60
$ emailFactory = $ this ->getMock ('Magento\Email\Model\TemplateFactory ' , ['create ' ], [], '' , false );
65
61
$ emailFactory ->expects ($ this ->once ())
66
62
->method ('create ' )
67
- ->with ($ this -> equalTo ([ ' data ' => $ designConfigData ]) )
68
- ->will ( $ this -> returnValue ( $ template) );
63
+ ->with ([] )
64
+ ->willReturn ( $ template );
69
65
70
66
$ request = $ this ->getMock ('Magento\Framework\App\RequestInterface ' );
71
- $ request ->expects ($ this ->any ())->method ('getParam ' )->will ( $ this -> returnValueMap ( $ requestParamMap) );
67
+ $ request ->expects ($ this ->any ())->method ('getParam ' )->willReturnMap ( $ requestParamMap );
72
68
$ eventManage = $ this ->getMock ('Magento\Framework\Event\ManagerInterface ' );
73
69
$ scopeConfig = $ this ->getMock ('Magento\Framework\App\Config\ScopeConfigInterface ' );
74
70
$ design = $ this ->getMock ('Magento\Framework\View\DesignInterface ' );
75
71
$ store = $ this ->getMock ('Magento\Store\Model\Store ' , ['getId ' , '__wakeup ' ], [], '' , false );
76
- $ store ->expects ($ this ->any ())->method ('getId ' )->will ( $ this -> returnValue ( $ storeId) );
72
+ $ store ->expects ($ this ->any ())->method ('getId ' )->willReturn ( $ storeId );
77
73
$ storeManager = $ this ->getMockBuilder ('\Magento\Store\Model\StoreManagerInterface ' )
78
74
->disableOriginalConstructor ()
79
75
->getMock ();
80
76
$ storeManager ->expects ($ this ->atLeastOnce ())
81
77
->method ('getDefaultStoreView ' )
82
- ->will ( $ this -> returnValue ( $ store) );
83
- $ storeManager ->expects ($ this ->any ())->method ('getDefaultStoreView ' )->will ( $ this -> returnValue ( null ) );
84
- $ storeManager ->expects ($ this ->any ())->method ('getStores ' )->will ( $ this -> returnValue ( [$ store ]) );
78
+ ->willReturn ( $ store );
79
+ $ storeManager ->expects ($ this ->any ())->method ('getDefaultStoreView ' )->willReturn ( null );
80
+ $ storeManager ->expects ($ this ->any ())->method ('getStores ' )->willReturn ( [$ store ]);
85
81
$ appState = $ this ->getMockBuilder ('Magento\Framework\App\State ' )
86
82
->setConstructorArgs ([
87
83
$ scopeConfig
@@ -94,12 +90,12 @@ public function testToHtml($requestParamMap)
94
90
['getRequest ' , 'getEventManager ' , 'getScopeConfig ' , 'getDesignPackage ' , 'getStoreManager ' , 'getAppState ' ],
95
91
[], '' , false
96
92
);
97
- $ context ->expects ($ this ->any ())->method ('getRequest ' )->will ( $ this -> returnValue ( $ request) );
98
- $ context ->expects ($ this ->any ())->method ('getEventManager ' )->will ( $ this -> returnValue ( $ eventManage) );
99
- $ context ->expects ($ this ->any ())->method ('getScopeConfig ' )->will ( $ this -> returnValue ( $ scopeConfig) );
100
- $ context ->expects ($ this ->any ())->method ('getDesignPackage ' )->will ( $ this -> returnValue ( $ design) );
101
- $ context ->expects ($ this ->any ())->method ('getStoreManager ' )->will ( $ this -> returnValue ( $ storeManager) );
102
- $ context ->expects ($ this ->once ())->method ('getAppState ' )->will ( $ this -> returnValue ( $ appState) );
93
+ $ context ->expects ($ this ->any ())->method ('getRequest ' )->willReturn ( $ request );
94
+ $ context ->expects ($ this ->any ())->method ('getEventManager ' )->willReturn ( $ eventManage );
95
+ $ context ->expects ($ this ->any ())->method ('getScopeConfig ' )->willReturn ( $ scopeConfig );
96
+ $ context ->expects ($ this ->any ())->method ('getDesignPackage ' )->willReturn ( $ design );
97
+ $ context ->expects ($ this ->any ())->method ('getStoreManager ' )->willReturn ( $ storeManager );
98
+ $ context ->expects ($ this ->once ())->method ('getAppState ' )->willReturn ( $ appState );
103
99
104
100
$ maliciousCode = $ this ->getMock (
105
101
'Magento\Framework\Filter\Input\MaliciousCode ' ,
@@ -108,8 +104,10 @@ public function testToHtml($requestParamMap)
108
104
'' ,
109
105
false
110
106
);
111
- $ maliciousCode ->expects ($ this ->once ())->method ('filter ' )->with ($ this ->equalTo ($ requestParamMap [1 ][2 ]))
112
- ->will ($ this ->returnValue (self ::MALICIOUS_TEXT ));
107
+ $ maliciousCode ->expects ($ this ->once ())
108
+ ->method ('filter ' )
109
+ ->with ($ this ->equalTo ($ requestParamMap [1 ][2 ]))
110
+ ->willReturn (self ::MALICIOUS_TEXT );
113
111
114
112
$ preview = $ this ->objectManagerHelper ->getObject (
115
113
'Magento\Email\Block\Adminhtml\Template\Preview ' ,
0 commit comments