function testWrongPwd()
 {
     $this->expectException(new Errors\NetworkError($this->credentials->paymentHost . '/payment', 401, 'The requested URL returned error: 401'));
     Config::set($this->credentials->user, 'wrong password', Config::ENV_SANDBOX);
     $data = $this->fixture('wpf_payment_request_simple.json');
     $payment = Payment::wpf($data);
 }
 function setUp()
 {
     Config::setIdSeparator(false);
     XmlSerializer::$sort = false;
     $this->curl = $curl = m::mock('Curl');
     $factory = m::mock(new Factory());
     $factory->shouldReceive('createHttpsClient')->with('the user', 'the passw')->andReturn($curl);
     // Scheduler calls without params - so defaults are used
     $factory->shouldReceive('createHttpsClient')->andReturn($curl);
     Config::setFactory($factory);
     Config::set('the user', 'the passw', Config::ENV_SANDBOX);
 }
 function testNotificationMissingPasswordThrows()
 {
     $postData = $this->schemaNotification('transaction_notification.json');
     Config::set('username', '', Config::ENV_SANDBOX);
     $this->assertEqual('', Config::getPassword());
     try {
         Transaction::notification($postData);
         $this->fail('Errors\\ArgumentError expected!');
     } catch (Errors\ArgumentError $exe) {
         $this->assertEqual('password is not configured! See Hypercharge\\Config::set()', $exe->getMessage());
         return;
     } catch (Exception $exe) {
         $this->fail('unexpected Exception: ' . $exe->toString());
     }
 }
Пример #4
0
 /**
  * mocks the network layer
  * @param int $times how often XmlWebservice::call is expected to be called
  * @return Mockery of Hypercharge\Curl
  */
 function curlMock($times = 1)
 {
     $curl = m::mock('curl');
     $factory = m::mock('Hypercharge\\Factory[createHttpsClient]');
     $factory->shouldReceive('createHttpsClient')->times($times)->with('the user', 'the passw')->andReturn($curl);
     Config::setFactory($factory);
     Config::set('the user', 'the passw', Config::ENV_SANDBOX);
     Config::setIdSeparator(false);
     return $curl;
 }