Skip to content

Instantly share code, notes, and snippets.

@porty
Created January 19, 2014 22:38
Show Gist options
  • Select an option

  • Save porty/8511959 to your computer and use it in GitHub Desktop.

Select an option

Save porty/8511959 to your computer and use it in GitHub Desktop.
Guzzle HTTP stub classes (replaced by SimpleTest mocking)
class GuzzleResponseStub
{
public function isSuccessful()
{
return true;
}
public function json()
{
return array('refund_id' => 999);
}
}
class GuzzleRequestStub
{
public function send()
{
return new GuzzleResponseStub();
}
}
class GuzzleClientStub
{
/**
* @var GuzzleClientStub
*/
public static $global = null;
public $moreUrl;
public $headers;
public $data;
public function __construct()
{
self::$global = $this;
}
public function post($moreUrl, $headers, $data)
{
$this->moreUrl = $moreUrl;
$this->headers = $headers;
$this->data = $data;
return new GuzzleRequestStub();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment