public function testCreateRest() { $this->scopeConfig->expects($this->once())->method('isSetFlag')->with($this->equalTo(Payupl::XML_PATH_CLASSIC_API), $this->equalTo('store'))->willReturn(false); $object = $this->getMockBuilder(Client::class)->disableOriginalConstructor()->getMock(); $this->objectManager->expects($this->once())->method('create')->with($this->equalTo(Client\Rest::class), $this->equalTo([]))->willReturn($object); $this->assertEquals($object, $this->model->create()); }
/** * @covers aRvi\Client\ClientFactory::getClient */ public function testGetClientWithInvalidData() { $_SERVER = array("REMOTE_ADDR" => "not-an-ip", "HTTP_X_FORWARDED_FOR" => "192.168.0.1"); $client = ClientFactory::getClient(); $this->assertAttributeEquals(null, "strIpAddress", $client); $this->assertAttributeEquals(null, "strRealIpAddress", $client); }
private static function getClient() { $client = ClientFactory::getInstance(); if (!$client->isCustom() && (function_exists("wp_remote_get") && $client->getType() != ClientFactory::WP_CLIENT)) { $client->setToWP(); } return $client; }
/** * @expectedException InvalidArgumentException * @dataProvider getInvalidClasses */ public function testInvalidProviderThrowsException($class) { $client = ClientFactory::create(["adapter" => ["name" => $class]]); }
public function showMerchant($id) { define('API', 'PS'); require_once 'siteadmin/includes/config/affiliatewindow.php'; require_once 'siteadmin/includes/libs/affiliatewindow/class.ClientFactory.php'; $oClient = ClientFactory::getClient(API_USERNAME, API_PASSWORD, API_USER_TYPE); $listmerchants = array('iMerchantId' => $id, 'sColumnToReturn' => array('sStrapline', 'sDescription', 'sLogoUrl', 'sDisplayUrl', 'sClickThroughUrl', 'oDiscountCode', 'oCommissionRange')); $oResponse = $oClient->call('getMerchant', $listmerchants); }