Created
January 19, 2014 22:38
-
-
Save porty/8511959 to your computer and use it in GitHub Desktop.
Guzzle HTTP stub classes (replaced by SimpleTest mocking)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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