/** * @see PaymentApi::ping() */ public function testPingWrongCredentials() { try { $this->credentials->setApiLogin('wrong-login')->setApiKey('wrong-key'); $rs = $this->object->ping(); } catch (\Exception $e) { $this->assertInstanceOf('\\PayU\\PayUException', $e); $this->assertEquals('Invalid credentials', $e->getMessage()); $this->assertEquals(0, $e->getCode()); } }
/** * Add merchant credentials to json. * * @param string $json Json command. * @return string */ protected function addMerchant($json) { $merchant = array('apiLogin' => $this->credentials->getApiLogin(), 'apiKey' => $this->credentials->getApiKey()); $array = json_decode($json, true); $array['merchant'] = $merchant; return json_encode($array); }
/** * @see MerchantCredentials::setApiKey() */ public function testSetApiKeyNewInstance() { $this->object = new MerchantCredentials(); $apiKey = 'apiKey_' . rand(1, 1000); $rs = $this->object->setApiKey($apiKey); $this->assertInstanceOf('\\PayU\\Merchant\\MerchantCredentials', $rs); $rs = $this->object->getApiKey(); $this->assertInternalType('string', $rs); $this->assertEquals($apiKey, $rs); }
/** * TearDown. */ protected function tearDown() { $this->credentials->resetInstance(); unset($this->object, $this->credentials); }