-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from bmeclazcke/master
Updated with tests and fixed class paths
- Loading branch information
Showing
5 changed files
with
94 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace Omnipay\Stripe\Message; | ||
|
||
use Omnipay\Tests\TestCase; | ||
|
||
class ListInvoicesRequestTest extends TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
$this->request = new ListPlansRequest($this->getHttpClient(), $this->getHttpRequest()); | ||
} | ||
|
||
public function testEndpoint() | ||
{ | ||
$this->assertSame('https://api.stripe.com/v1/plans', $this->request->getEndpoint()); | ||
} | ||
|
||
public function testSendSuccess() | ||
{ | ||
$this->setMockHttpResponse('ListPlans.txt'); | ||
$response = $this->request->send(); | ||
|
||
$this->assertTrue($response->isSuccessful()); | ||
$this->assertFalse($response->isRedirect()); | ||
$this->assertNotNull($response->getList()); | ||
$this->assertNull($response->getMessage()); | ||
} | ||
|
||
/** | ||
* According to documentation: https://stripe.com/docs/api/php#list_plans | ||
* This request should never throw an error. | ||
*/ | ||
public function testSendFailure() | ||
{ | ||
this->assertTrue(true); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
HTTP/1.1 200 OK | ||
Server: nginx | ||
Date: Mon, 29 Feb 2016 02:40:46 GMT | ||
Content-Type: application/json | ||
Content-Length: 6247 | ||
Connection: keep-alive | ||
Access-Control-Allow-Credentials: true | ||
Cache-Control: no-cache, no-store | ||
|
||
{ | ||
"object" => "list", | ||
"url" => "/v1/plans", | ||
"has_more" => false, | ||
"data" => [ | ||
{ | ||
"id": "test-1", | ||
"object": "plan", | ||
"amount": 29995, | ||
"created": 1483391153, | ||
"currency": "usd", | ||
"interval": "year", | ||
"interval_count": 1, | ||
"livemode": false, | ||
"metadata": { | ||
}, | ||
"name": "Test 1", | ||
"statement_descriptor": "Test 1", | ||
"trial_period_days": 14 | ||
}, | ||
{ | ||
"id": "test-2", | ||
"object": "plan", | ||
"amount": 29995, | ||
"created": 1483391153, | ||
"currency": "usd", | ||
"interval": "year", | ||
"interval_count": 1, | ||
"livemode": false, | ||
"metadata": { | ||
}, | ||
"name": "Test 1", | ||
"statement_descriptor": "Test 2", | ||
"trial_period_days": 14 | ||
} | ||
] | ||
} |