File tree Expand file tree Collapse file tree 3 files changed +21
-20
lines changed
lib/internal/Magento/Framework
Test/Unit/Transfer/Adapter Expand file tree Collapse file tree 3 files changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -181,13 +181,9 @@ public function testLaunchException()
181
181
$ this ->setUpLaunch ();
182
182
$ this ->frontControllerMock ->expects ($ this ->once ())
183
183
->method ('dispatch ' )
184
- ->with ($ this ->requestMock )->will (
185
- $ this ->returnCallback (
186
- function () {
187
- // phpcs:ignore Magento2.Exceptions.DirectThrow
188
- throw new \Exception ('Message ' );
189
- }
190
- )
184
+ ->with ($ this ->requestMock )
185
+ ->willThrowException (
186
+ new \Exception ('Message ' )
191
187
);
192
188
$ this ->http ->launch ();
193
189
}
Original file line number Diff line number Diff line change @@ -73,10 +73,10 @@ public function testSend(): void
73
73
$ this ->mime ->expects ($ this ->once ())
74
74
->method ('getMimeType ' )
75
75
->with ($ file )
76
- ->will ( $ this -> returnValue ( $ contentType) );
76
+ ->willReturn ( $ contentType );
77
77
$ this ->request ->expects ($ this ->once ())
78
78
->method ('isHead ' )
79
- ->will ( $ this -> returnValue ( false ) );
79
+ ->willReturn ( false );
80
80
$ this ->expectOutputString (file_get_contents ($ file ));
81
81
82
82
$ this ->object ->send ($ file );
Original file line number Diff line number Diff line change 6
6
7
7
namespace Magento \Framework \File \Transfer \Adapter ;
8
8
9
+ use Magento \Framework \HTTP \PhpEnvironment \Response ;
10
+ use Magento \Framework \File \Mime ;
11
+ use Magento \Framework \App \Request \Http as HttpRequest ;
12
+ use Magento \Framework \App \ObjectManager ;
13
+
9
14
/**
10
15
* File adapter to send the file to the client.
11
16
*/
12
17
class Http
13
18
{
14
19
/**
15
- * @var \Magento\Framework\HTTP\PhpEnvironment\ Response
20
+ * @var Response
16
21
*/
17
22
private $ response ;
18
23
19
24
/**
20
- * @var \Magento\Framework\File\ Mime
25
+ * @var Mime
21
26
*/
22
27
private $ mime ;
23
28
24
29
/**
25
- * @var \Magento\Framework\App\Request\Http
30
+ * @var HttpRequest
26
31
*/
27
32
private $ request ;
28
33
29
34
/**
30
- * @param \Magento\Framework\HTTP\PhpEnvironment\ Response $response
31
- * @param \Magento\Framework\File\ Mime $mime
32
- * @param \Magento\Framework\App\Request\Http |null $request
35
+ * @param Response $response
36
+ * @param Mime $mime
37
+ * @param HttpRequest |null $request
33
38
*/
34
39
public function __construct (
35
- \ Magento \ Framework \ HTTP \ PhpEnvironment \ Response $ response ,
36
- \ Magento \ Framework \ File \ Mime $ mime ,
37
- \ Magento \ Framework \ App \ Request \ Http $ request = null
40
+ Response $ response ,
41
+ Mime $ mime ,
42
+ HttpRequest $ request = null
38
43
) {
39
44
$ this ->response = $ response ;
40
45
$ this ->mime = $ mime ;
41
- $ objectManager = \ Magento \ Framework \ App \ ObjectManager::getInstance ();
42
- $ this ->request = $ request ?: $ objectManager ->get (\ Magento \ Framework \ App \ Request \Http ::class);
46
+ $ objectManager = ObjectManager::getInstance ();
47
+ $ this ->request = $ request ?: $ objectManager ->get (HttpRequest ::class);
43
48
}
44
49
45
50
/**
You can’t perform that action at this time.
0 commit comments