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()
181181 $ this ->setUpLaunch ();
182182 $ this ->frontControllerMock ->expects ($ this ->once ())
183183 ->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 ' )
191187 );
192188 $ this ->http ->launch ();
193189 }
Original file line number Diff line number Diff line change @@ -73,10 +73,10 @@ public function testSend(): void
7373 $ this ->mime ->expects ($ this ->once ())
7474 ->method ('getMimeType ' )
7575 ->with ($ file )
76- ->will ( $ this -> returnValue ( $ contentType) );
76+ ->willReturn ( $ contentType );
7777 $ this ->request ->expects ($ this ->once ())
7878 ->method ('isHead ' )
79- ->will ( $ this -> returnValue ( false ) );
79+ ->willReturn ( false );
8080 $ this ->expectOutputString (file_get_contents ($ file ));
8181
8282 $ this ->object ->send ($ file );
Original file line number Diff line number Diff line change 66
77namespace Magento \Framework \File \Transfer \Adapter ;
88
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+
914/**
1015 * File adapter to send the file to the client.
1116 */
1217class Http
1318{
1419 /**
15- * @var \Magento\Framework\HTTP\PhpEnvironment\ Response
20+ * @var Response
1621 */
1722 private $ response ;
1823
1924 /**
20- * @var \Magento\Framework\File\ Mime
25+ * @var Mime
2126 */
2227 private $ mime ;
2328
2429 /**
25- * @var \Magento\Framework\App\Request\Http
30+ * @var HttpRequest
2631 */
2732 private $ request ;
2833
2934 /**
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
3338 */
3439 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
3843 ) {
3944 $ this ->response = $ response ;
4045 $ 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);
4348 }
4449
4550 /**
You can’t perform that action at this time.
0 commit comments