Skip to content

Commit

Permalink
Merge pull request #513 from stripe/remi-stripe-mock-30
Browse files Browse the repository at this point in the history
Move to stripe-mock 0.30.0 and fix test suite
  • Loading branch information
remi-stripe authored Aug 30, 2018
2 parents 8094ae2 + c2e6728 commit 40dc4fb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ php:

env:
global:
- STRIPE_MOCK_VERSION=0.26.0
- STRIPE_MOCK_VERSION=0.30.0
matrix:
- AUTOLOAD=1
- AUTOLOAD=0
Expand Down
12 changes: 10 additions & 2 deletions tests/Stripe/RecipientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,18 @@ public function testIsDeletable()
public function testCanListTransfers()
{
$recipient = Recipient::retrieve(self::TEST_RESOURCE_ID);
$this->expectsRequest(

// stripe-mock does not support this anymore so we stub it
$this->stubRequest(
'get',
'/v1/transfers',
["recipient" => $recipient->id]
["recipient" => $recipient->id],
null,
false,
[
"object" => "list",
"data" => [["id" => "tr_123", "object" => "transfer"]]
]
);
$resources = $recipient->transfers();
$this->assertTrue(is_array($resources->data));
Expand Down
9 changes: 7 additions & 2 deletions tests/Stripe/SubscriptionItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ public function testIsListable()
{
$this->expectsRequest(
'get',
'/v1/subscription_items'
'/v1/subscription_items',
[
"subscription" => "sub_123"
]
);
$resources = SubscriptionItem::all();
$resources = SubscriptionItem::all([
"subscription" => "sub_123"
]);
$this->assertTrue(is_array($resources->data));
$this->assertInstanceOf("Stripe\\SubscriptionItem", $resources->data[0]);
}
Expand Down
8 changes: 2 additions & 6 deletions tests/Stripe/SubscriptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,9 @@ public function testIsCancelable()
$this->expectsRequest(
'delete',
'/v1/subscriptions/' . $resource->id,
[
'at_period_end' => 'true',
]
[]
);
$resource->cancel([
'at_period_end' => true,
]);
$resource->cancel([]);
$this->assertInstanceOf("Stripe\\Subscription", $resource);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

define("MOCK_MINIMUM_VERSION", "0.26.0");
define("MOCK_MINIMUM_VERSION", "0.30.0");
define("MOCK_PORT", getenv("STRIPE_MOCK_PORT") ?: 12111);

// Send a request to stripe-mock
Expand Down

0 comments on commit 40dc4fb

Please sign in to comment.