11<?php
2- /**
3- * Copyright © Magento, Inc. All rights reserved.
4- * See COPYING.txt for license details.
2+ /************************************************************************
3+ *
4+ * ADOBE CONFIDENTIAL
5+ * ___________________
6+ *
7+ * Copyright 2015 Adobe
8+ * All Rights Reserved.
9+ *
10+ * NOTICE: All information contained herein is, and remains
11+ * the property of Adobe and its suppliers, if any. The intellectual
12+ * and technical concepts contained herein are proprietary to Adobe
13+ * and its suppliers and are protected by all applicable intellectual
14+ * property laws, including trade secret and copyright laws.
15+ * Dissemination of this information or reproduction of this material
16+ * is strictly forbidden unless prior written permission is obtained
17+ * from Adobe.
18+ * ************************************************************************
519 */
620
721declare (strict_types=1 );
4559use Psr \Log \LoggerInterface ;
4660use Magento \Framework \HTTP \Client \CurlFactory ;
4761use Magento \Framework \HTTP \Client \Curl ;
62+ use Magento \Framework \Url \DecoderInterface ;
4863
4964/**
5065 * CarrierTest contains units test for Fedex carrier methods
@@ -93,11 +108,6 @@ class CarrierTest extends TestCase
93108 */
94109 private $ result ;
95110
96- /**
97- * @var \SoapClient|MockObject
98- */
99- private $ soapClient ;
100-
101111 /**
102112 * @var Json|MockObject
103113 */
@@ -123,6 +133,11 @@ class CarrierTest extends TestCase
123133 */
124134 private $ curlClient ;
125135
136+ /**
137+ * @var DecoderInterface
138+ */
139+ private $ decoderInterface ;
140+
126141 /**
127142 * @return void
128143 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
@@ -180,10 +195,6 @@ protected function setUp(): void
180195 ->disableOriginalConstructor ()
181196 ->getMock ();
182197
183- $ reader = $ this ->getMockBuilder (Reader::class)
184- ->disableOriginalConstructor ()
185- ->getMock ();
186-
187198 $ this ->serializer = $ this ->getMockBuilder (Json::class)
188199 ->disableOriginalConstructor ()
189200 ->getMock ();
@@ -200,6 +211,11 @@ protected function setUp(): void
200211 ->setMethods (['setHeaders ' , 'getBody ' , 'post ' ])
201212 ->getMock ();
202213
214+ $ this ->decoderInterface = $ this ->getMockBuilder (DecoderInterface::class)
215+ ->disableOriginalConstructor ()
216+ ->setMethods (['decode ' ])
217+ ->getMock ();
218+
203219 $ this ->carrier = $ this ->getMockBuilder (Carrier::class)
204220 ->setMethods (['_createSoapClient ' ])
205221 ->setConstructorArgs (
@@ -220,19 +236,13 @@ protected function setUp(): void
220236 'directoryData ' => $ data ,
221237 'stockRegistry ' => $ stockRegistry ,
222238 'storeManager ' => $ storeManager ,
223- 'configReader ' => $ reader ,
224239 'productCollectionFactory ' => $ collectionFactory ,
225240 'curlFactory ' => $ this ->curlFactory ,
241+ 'decoderInterface ' => $ this ->decoderInterface ,
226242 'data ' => [],
227243 'serializer ' => $ this ->serializer ,
228244 ]
229245 )->getMock ();
230- $ this ->soapClient = $ this ->getMockBuilder (\SoapClient::class)
231- ->disableOriginalConstructor ()
232- ->setMethods (['getRates ' , 'track ' ])
233- ->getMock ();
234- $ this ->carrier ->method ('_createSoapClient ' )
235- ->willReturn ($ this ->soapClient );
236246 }
237247
238248 public function testSetRequestWithoutCity ()
@@ -769,7 +779,7 @@ public function getAccessToken() : array
769779 $ this ->curlFactory ->expects ($ this ->any ())->method ('create ' )->willReturn ($ this ->curlClient );
770780 $ this ->curlClient ->expects ($ this ->any ())->method ('setHeaders ' )->willReturnSelf ();
771781 $ this ->curlClient ->expects ($ this ->any ())->method ('post ' )->willReturnSelf ();
772- $ this ->curlClient ->expects ($ this ->any ())->method ('getBody ' )->willReturnSelf ( );
782+ $ this ->curlClient ->expects ($ this ->any ())->method ('getBody ' )->willReturn ( json_encode ( $ accessTokenResponse ) );
773783 return $ accessTokenResponse ;
774784 }
775785
0 commit comments