/** * @return \GeoIp2\WebService\Client * @throws \Magento\Framework\Exception\LocalizedException */ protected function getClient() { if (null === $this->client) { $this->client = $this->clientFactory->create(); } return $this->client; }
/** * @param array|string $options * @param array $data * @dataProvider createDataProvider */ public function testCreate($options, $data) { $this->configureConfigMethods('config user id', 'config license key', 'config host'); $client = $this->getMockBuilder('GeoIp2\\WebService\\Client')->disableOriginalConstructor()->getMock(); $this->objectManager->expects($this->once())->method('create')->with($this->instanceName, $data)->willReturn($client); $this->assertSame($client, $this->clientFactory->create($options)); }
/** * @return \GeoIp2\WebService\Client|\PHPUnit_Framework_MockObject_MockObject */ protected function configureClientFactory() { $client = $this->getMockBuilder('GeoIp2\\WebService\\Client')->disableOriginalConstructor()->getMock(); $this->clientFactory->expects($this->once())->method('create')->willReturn($client); return $client; }