loadArea(Area::AREA_FRONTEND); $this->objectManager = Bootstrap::getObjectManager(); $this->clientMock = $this->createMock(ZendClient::class); $this->responseMock = $this->createMock(Zend_Http_Response::class); $this->clientMock->method('request') ->willReturn($this->responseMock); $this->clientMock->method('setUri') ->with('https://apitest.authorize.net/xml/v1/request.api'); $clientFactoryMock = $this->createMock(ZendClientFactory::class); $clientFactoryMock->method('create') ->willReturn($this->clientMock); /** @var PaymentDataObjectFactory $paymentFactory */ $this->paymentFactory = $this->objectManager->get(PaymentDataObjectFactory::class); $this->objectManager->addSharedInstance($clientFactoryMock, ZendClientFactory::class); } protected function tearDown() { $this->objectManager->removeSharedInstance(ZendClientFactory::class); parent::tearDown(); } protected function getOrderWithIncrementId(string $incrementId): Order { /** @var OrderRepositoryInterface $orderRepository */ $orderRepository = $this->objectManager->get(OrderRepositoryInterface::class); $searchCriteria = $this->objectManager->get(SearchCriteriaBuilder::class) ->addFilter('increment_id', $incrementId) ->create(); /** @var Order $order */ $order = current( $orderRepository->getList($searchCriteria) ->getItems() ); return $order; } }