|
32 | 32 | use Magento\Framework\Locale\FormatInterface;
|
33 | 33 | use Magento\Ups\Helper\Config;
|
34 | 34 | use Magento\Quote\Model\Quote\Address\RateRequest;
|
| 35 | +use Magento\Framework\HTTP\ClientFactory; |
| 36 | +use Magento\Framework\HTTP\ClientInterface; |
35 | 37 |
|
36 | 38 | /**
|
37 | 39 | * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
@@ -64,6 +66,11 @@ class CarrierCollectRatesOptionsTest extends \PHPUnit\Framework\TestCase
|
64 | 66 | */
|
65 | 67 | private $include_taxes;
|
66 | 68 |
|
| 69 | + /** |
| 70 | + * @var ClientInterface|MockObject |
| 71 | + */ |
| 72 | + private $httpClient; |
| 73 | + |
67 | 74 | /**
|
68 | 75 | * set up test environment
|
69 | 76 | *
|
@@ -115,6 +122,14 @@ protected function setUp()
|
115 | 122 | ->method('create')
|
116 | 123 | ->willReturn($rateResultMock);
|
117 | 124 |
|
| 125 | + $httpClientFactory = $this->getMockBuilder(ClientFactory::class) |
| 126 | + ->disableOriginalConstructor() |
| 127 | + ->setMethods(['create']) |
| 128 | + ->getMock(); |
| 129 | + $this->httpClient = $this->getMockForAbstractClass(ClientInterface::class); |
| 130 | + $httpClientFactory->method('create') |
| 131 | + ->willReturn($this->httpClient); |
| 132 | + |
118 | 133 | $priceInterfaceMock = $this->getMockBuilder(PriceCurrencyInterface::class)
|
119 | 134 | ->disableOriginalConstructor()
|
120 | 135 | ->getMock();
|
@@ -229,6 +244,7 @@ protected function setUp()
|
229 | 244 | 'stockRegistry' => $stockRegistryMock,
|
230 | 245 | 'localeFormat' => $formatInterfaceMock,
|
231 | 246 | 'configHelper' => $configHelperMock,
|
| 247 | + 'httpClientFactory' => $httpClientFactory, |
232 | 248 | 'data' => [],
|
233 | 249 | ]
|
234 | 250 | )
|
|
0 commit comments