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()); } }
function expect_Curl_jsonRequest() { $curl = m::mock('Hypercharge\\Curl[jsonRequest][close]', array(Config::getUser(), Config::getPassword())); $curl->shouldReceive('close'); $factory = m::mock('Hypercharge\\Factory[createHttpsClient]'); $factory->shouldReceive('createHttpsClient')->andReturn($curl); Config::setFactory($factory); return $curl->shouldReceive('jsonRequest'); }