@@ -120,12 +120,11 @@ public function testExecuteParamFile()
120
120
$ this ->storage ->expects ($ this ->once ())->method ('processStorageFile ' )->with ($ path )->willReturn (true );
121
121
122
122
$ this ->objectManager ->expects ($ this ->any ())->method ('get ' )
123
- ->will ( $ this -> returnValueMap (
123
+ ->willReturnMap (
124
124
[
125
125
['Magento\Framework\Filesystem ' , $ this ->fileSystemMock ],
126
126
['Magento\Core\Helper\File\Storage ' , $ this ->storage ]
127
127
]
128
- )
129
128
);
130
129
131
130
$ this ->urlDecoderMock ->expects ($ this ->once ())->method ('decode ' )->with ($ decodedFile )->willReturn ($ file );
@@ -158,9 +157,8 @@ public function testExecuteGetParamImage()
158
157
$ path = 'path ' ;
159
158
$ stat = ['size ' => 10 , 'mtime ' => 10 ];
160
159
161
- $ this ->requestMock ->expects ($ this ->at (0 ))->method ('getParam ' )->with ('file ' )->willReturn (null );
162
- $ this ->requestMock ->expects ($ this ->at (1 ))->method ('getParam ' )->with ('image ' )->willReturn ($ decodedFile );
163
- $ this ->requestMock ->expects ($ this ->at (2 ))->method ('getParam ' )->with ('image ' )->willReturn ($ decodedFile );
160
+ $ this ->requestMock ->expects ($ this ->any ())->method ('getParam ' )
161
+ ->willReturnMap ([['file ' , null , null ], ['image ' , null , $ decodedFile ]]);
164
162
165
163
$ this ->directoryMock ->expects ($ this ->once ())->method ('getAbsolutePath ' )->with ($ fileName )->willReturn ($ path );
166
164
$ this ->directoryMock ->expects ($ this ->once ())->method ('stat ' )->with ($ path )->willReturn ($ stat );
@@ -171,26 +169,27 @@ public function testExecuteGetParamImage()
171
169
172
170
$ this ->storage ->expects ($ this ->once ())->method ('processStorageFile ' )->with ($ path )->willReturn (true );
173
171
174
- $ this ->objectManager ->expects ($ this ->at (0 ))->method ('get ' )->with ('Magento\Framework\Filesystem ' )
175
- ->willReturn ($ this ->fileSystemMock );
176
- $ this ->objectManager ->expects ($ this ->at (1 ))->method ('get ' )->with ('Magento\Core\Helper\File\Storage ' )
177
- ->willReturn ($ this ->storage );
172
+ $ this ->objectManager ->expects ($ this ->any ())->method ('get ' )
173
+ ->willReturnMap (
174
+ [
175
+ ['Magento\Framework\Filesystem ' , $ this ->fileSystemMock ],
176
+ ['Magento\Core\Helper\File\Storage ' , $ this ->storage ]
177
+ ]
178
+ );
179
+
178
180
179
181
$ this ->urlDecoderMock ->expects ($ this ->once ())->method ('decode ' )->with ($ decodedFile )->willReturn ($ file );
180
182
181
183
$ this ->resultRawMock ->expects ($ this ->once ())->method ('setHttpResponseCode ' )->with (200 )->willReturnSelf ();
182
- $ this ->resultRawMock ->expects ($ this ->at (1 ))->method ('setHeader ' )
183
- ->with ('Pragma ' , 'public ' , true )
184
- ->willReturnSelf ();
185
- $ this ->resultRawMock ->expects ($ this ->at (2 ))->method ('setHeader ' )
186
- ->with ('Content-type ' , 'application/octet-stream ' , true )
187
- ->willReturnSelf ();
188
- $ this ->resultRawMock ->expects ($ this ->at (3 ))->method ('setHeader ' )
189
- ->with ('Content-Length ' , $ stat ['size ' ])
190
- ->willReturnSelf ();
191
- $ this ->resultRawMock ->expects ($ this ->at (4 ))->method ('setHeader ' )
192
- ->with ('Last-Modified ' , date ('r ' , $ stat ['mtime ' ]))
193
- ->willReturnSelf ();
184
+ $ this ->resultRawMock ->expects ($ this ->any ())->method ('setHeader ' )
185
+ ->willReturnMap (
186
+ [
187
+ ['Pragma ' , 'public ' , true , $ this ->resultRawMock ],
188
+ ['Content-type ' , 'application/octet-stream ' , true , $ this ->resultRawMock ],
189
+ ['Content-Length ' , $ stat ['size ' ], false , $ this ->resultRawMock ],
190
+ ['Pragma ' , 'public ' , true , $ this ->resultRawMock ],
191
+ ]
192
+ );
194
193
195
194
$ this ->resultRawFactoryMock = $ this ->getMock (
196
195
'Magento\Framework\Controller\Result\RawFactory ' ,
0 commit comments