Skip to content

Commit

Permalink
Merge ca02aa8 into 47e66d4
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe committed Mar 29, 2021
2 parents 47e66d4 + ca02aa8 commit 626be2f
Show file tree
Hide file tree
Showing 121 changed files with 165 additions and 162 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
- "7.2"
- "7.3"
- "7.4"
- "8.0"

steps:
- uses: actions/checkout@master
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ clover.xml
# Ignore phpDocumentor's local config and artifacts
.phpdoc/*
phpdoc.xml

.phpunit.result.cache
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"phpunit/phpunit": "9.5.4",
"php-coveralls/php-coveralls": "^2.1",
"squizlabs/php_codesniffer": "^3.3",
"symfony/process": "~3.4",
Expand Down
10 changes: 5 additions & 5 deletions tests/Stripe/AccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testIsListable()
'/v1/accounts'
);
$resources = Account::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\Account::class, $resources->data[0]);
}

Expand Down Expand Up @@ -132,7 +132,7 @@ public function testPersons()
'/v1/accounts/' . $account->id . '/persons'
);
$persons = $account->persons();
static::assertInternalType('array', $persons->data);
static::assertIsArray($persons->data);
static::assertInstanceOf(\Stripe\Person::class, $persons->data[0]);
}

Expand Down Expand Up @@ -165,7 +165,7 @@ public function testCanListCapabilities()
'/v1/accounts/' . self::TEST_RESOURCE_ID . '/capabilities'
);
$resources = Account::allCapabilities(self::TEST_RESOURCE_ID);
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
}

public function testCanCreateExternalAccount()
Expand Down Expand Up @@ -219,7 +219,7 @@ public function testCanListExternalAccounts()
'/v1/accounts/' . self::TEST_RESOURCE_ID . '/external_accounts'
);
$resources = Account::allExternalAccounts(self::TEST_RESOURCE_ID);
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
}

public function testCanCreateLoginLink()
Expand Down Expand Up @@ -287,7 +287,7 @@ public function testCanListPersons()
'/v1/accounts/' . self::TEST_RESOURCE_ID . '/persons'
);
$resources = Account::allPersons(self::TEST_RESOURCE_ID);
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
}

public function testSerializeNewAdditionalOwners()
Expand Down
18 changes: 9 additions & 9 deletions tests/Stripe/ApiRequestorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function testDefaultHeaders()
public function testRaisesAuthenticationErrorWhenNoApiKey()
{
$this->expectException(\Stripe\Exception\AuthenticationException::class);
$this->expectExceptionMessageRegExp('#No API key provided#');
$this->expectExceptionMessageMatches('#No API key provided#');

Stripe::setApiKey(null);
Charge::create();
Expand Down Expand Up @@ -117,7 +117,7 @@ public function testRaisesInvalidRequestErrorOn400()
static::fail('Did not raise error');
} catch (Exception\InvalidRequestException $e) {
static::assertSame(400, $e->getHttpStatus());
static::assertInternalType('array', $e->getJsonBody());
static::assertIsArray($e->getJsonBody());
static::assertSame('Missing id', $e->getMessage());
static::assertSame('id', $e->getStripeParam());
} catch (\Exception $e) {
Expand Down Expand Up @@ -147,7 +147,7 @@ public function testRaisesIdempotencyErrorOn400AndTypeIdempotencyError()
static::fail('Did not raise error');
} catch (Exception\IdempotencyException $e) {
static::assertSame(400, $e->getHttpStatus());
static::assertInternalType('array', $e->getJsonBody());
static::assertIsArray($e->getJsonBody());
static::assertSame("Keys for idempotent requests can only be used with the same parameters they were first used with. Try using a key other than 'abc' if you meant to execute a different request.", $e->getMessage());
} catch (\Exception $e) {
static::fail('Unexpected exception: ' . \get_class($e));
Expand Down Expand Up @@ -176,7 +176,7 @@ public function testRaisesAuthenticationErrorOn401()
static::fail('Did not raise error');
} catch (Exception\AuthenticationException $e) {
static::assertSame(401, $e->getHttpStatus());
static::assertInternalType('array', $e->getJsonBody());
static::assertIsArray($e->getJsonBody());
static::assertSame('You did not provide an API key.', $e->getMessage());
} catch (\Exception $e) {
static::fail('Unexpected exception: ' . \get_class($e));
Expand Down Expand Up @@ -209,7 +209,7 @@ public function testRaisesCardErrorOn402()
static::fail('Did not raise error');
} catch (Exception\CardException $e) {
static::assertSame(402, $e->getHttpStatus());
static::assertInternalType('array', $e->getJsonBody());
static::assertIsArray($e->getJsonBody());
static::assertSame('Your card was declined.', $e->getMessage());
static::assertSame('card_declined', $e->getStripeCode());
static::assertSame('generic_decline', $e->getDeclineCode());
Expand Down Expand Up @@ -241,7 +241,7 @@ public function testRaisesPermissionErrorOn403()
static::fail('Did not raise error');
} catch (Exception\PermissionException $e) {
static::assertSame(403, $e->getHttpStatus());
static::assertInternalType('array', $e->getJsonBody());
static::assertIsArray($e->getJsonBody());
static::assertSame("The provided key 'sk_test_********************1234' does not have access to account 'foo' (or that account does not exist). Application access may have been revoked.", $e->getMessage());
} catch (\Exception $e) {
static::fail('Unexpected exception: ' . \get_class($e));
Expand Down Expand Up @@ -271,7 +271,7 @@ public function testRaisesInvalidRequestErrorOn404()
static::fail('Did not raise error');
} catch (Exception\InvalidRequestException $e) {
static::assertSame(404, $e->getHttpStatus());
static::assertInternalType('array', $e->getJsonBody());
static::assertIsArray($e->getJsonBody());
static::assertSame('No such charge: foo', $e->getMessage());
static::assertSame('id', $e->getStripeParam());
} catch (\Exception $e) {
Expand Down Expand Up @@ -300,7 +300,7 @@ public function testRaisesRateLimitErrorOn429()
static::fail('Did not raise error');
} catch (Exception\RateLimitException $e) {
static::assertSame(429, $e->getHttpStatus());
static::assertInternalType('array', $e->getJsonBody());
static::assertIsArray($e->getJsonBody());
static::assertSame('Too many requests', $e->getMessage());
} catch (\Exception $e) {
\var_dump($e);
Expand Down Expand Up @@ -330,7 +330,7 @@ public function testRaisesRateLimitErrorOn400AndCodeRateLimit()
static::fail('Did not raise error');
} catch (Exception\RateLimitException $e) {
static::assertSame(400, $e->getHttpStatus());
static::assertInternalType('array', $e->getJsonBody());
static::assertIsArray($e->getJsonBody());
static::assertSame('Too many requests', $e->getMessage());
} catch (\Exception $e) {
static::fail('Unexpected exception: ' . \get_class($e));
Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/ApplePayDomainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIsListable()
'/v1/apple_pay/domains'
);
$resources = ApplePayDomain::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\ApplePayDomain::class, $resources->data[0]);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Stripe/ApplicationFeeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testIsListable()
'/v1/application_fees'
);
$resources = ApplicationFee::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\ApplicationFee::class, $resources->data[0]);
}

Expand Down Expand Up @@ -71,7 +71,7 @@ public function testCanListRefunds()
'/v1/application_fees/' . self::TEST_RESOURCE_ID . '/refunds'
);
$resources = ApplicationFee::allRefunds(self::TEST_RESOURCE_ID);
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\ApplicationFeeRefund::class, $resources->data[0]);
}
}
2 changes: 1 addition & 1 deletion tests/Stripe/BalanceTransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIsListable()
'/v1/balance_transactions'
);
$resources = BalanceTransaction::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\BalanceTransaction::class, $resources->data[0]);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Stripe/BaseStripeClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function testRequestThrowsIfNoApiKeyInClientAndOpts()
public function testRequestThrowsIfOptsIsString()
{
$this->expectException(\Stripe\Exception\InvalidArgumentException::class);
$this->expectExceptionMessageRegExp('#Do not pass a string for request options.#');
$this->expectExceptionMessageMatches('#Do not pass a string for request options.#');

$client = new BaseStripeClient(['api_base' => MOCK_URL]);
$charge = $client->request('get', '/v1/charges/ch_123', [], 'foo');
Expand Down Expand Up @@ -181,7 +181,7 @@ public function testRequestCollectionThrowsForNonList()

public function testRequestWithOptsInParamsWarns()
{
$this->expectException(\PHPUnit_Framework_Error_Warning::class);
$this->expectWarning();
$this->expectExceptionMessage('Options found in $params: api_key, stripe_account, api_base. Options should be '
. 'passed in their own array after $params. (HINT: pass an empty array to $params if you do not have any.)');
$client = new BaseStripeClient([
Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/BitcoinReceiverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testIsListable()
'/v1/bitcoin/receivers'
);
$resources = BitcoinReceiver::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertSame(\Stripe\BitcoinReceiver::class, \get_class($resources->data[0]));
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/ChargeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIsListable()
'/v1/charges'
);
$resources = Charge::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\Charge::class, $resources->data[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/Checkout/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function testCanListLineItems()
'/v1/checkout/sessions/' . self::TEST_RESOURCE_ID . '/line_items'
);
$resources = Session::allLineItems(self::TEST_RESOURCE_ID);
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\LineItem::class, $resources->data[0]);
}
}
4 changes: 2 additions & 2 deletions tests/Stripe/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function setUpFixture()
public function testOffsetGetNumericIndex()
{
$this->expectException(\Stripe\Exception\InvalidArgumentException::class);
$this->expectExceptionMessageRegExp('/You tried to access the \\d index/');
$this->expectExceptionMessageMatches('/You tried to access the \\d index/');

$this->fixture[0];
}
Expand All @@ -50,7 +50,7 @@ public function testCanList()
);

$resources = $this->fixture->all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
}

public function testCanRetrieve()
Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/CountrySpecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIsListable()
'/v1/country_specs'
);
$resources = CountrySpec::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\CountrySpec::class, $resources->data[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/CouponTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIsListable()
'/v1/coupons'
);
$resources = Coupon::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\Coupon::class, $resources->data[0]);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Stripe/CreditNoteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIsListable()
'/v1/credit_notes'
);
$resources = CreditNote::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\CreditNote::class, $resources->data[0]);
}

Expand Down Expand Up @@ -103,6 +103,6 @@ public function testCanListLines()
'/v1/credit_notes/' . self::TEST_RESOURCE_ID . '/lines'
);
$resources = CreditNote::allLines(self::TEST_RESOURCE_ID);
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
}
}
8 changes: 4 additions & 4 deletions tests/Stripe/CustomerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testIsListable()
'/v1/customers'
);
$resources = Customer::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\Customer::class, $resources->data[0]);
}

Expand Down Expand Up @@ -137,7 +137,7 @@ public function testCanListSources()
'/v1/customers/' . self::TEST_RESOURCE_ID . '/sources'
);
$resources = Customer::allSources(self::TEST_RESOURCE_ID);
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
}

public function testSerializeSourceString()
Expand Down Expand Up @@ -213,7 +213,7 @@ public function testCanListTaxIds()
'/v1/customers/' . self::TEST_RESOURCE_ID . '/tax_ids'
);
$resources = Customer::allTaxIds(self::TEST_RESOURCE_ID);
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
}

public function testCanCreateBalanceTransaction()
Expand Down Expand Up @@ -253,6 +253,6 @@ public function testCanListCustomerBalanceTransactions()
'/v1/customers/' . self::TEST_RESOURCE_ID . '/balance_transactions'
);
$resources = Customer::allBalanceTransactions(self::TEST_RESOURCE_ID);
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
}
}
2 changes: 1 addition & 1 deletion tests/Stripe/DisputeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIsListable()
'/v1/disputes'
);
$resources = Dispute::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\Dispute::class, $resources->data[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIsListable()
'/v1/events'
);
$resources = Event::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\Event::class, $resources->data[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/Exception/ApiErrorExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public function testGetters()
public function testToString()
{
$e = $this->createFixture();
static::assertContains('(Request req_test)', (string) $e);
static::assertStringContainsString('(Request req_test)', (string) $e);
}
}
2 changes: 1 addition & 1 deletion tests/Stripe/Exception/OAuth/OAuthErrorExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public function testGetters()
public function testToString()
{
$e = $this->createFixture();
static::assertContains('(Request req_test)', (string) $e);
static::assertStringContainsString('(Request req_test)', (string) $e);
}
}
2 changes: 1 addition & 1 deletion tests/Stripe/ExchangeRateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testIsListable()
);

$resources = ExchangeRate::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\ExchangeRate::class, $resources->data[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/FileLinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIsListable()
'/v1/file_links'
);
$resources = FileLink::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\FileLink::class, $resources->data[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIsListable()
'/v1/files'
);
$resources = File::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\File::class, $resources->data[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/HttpClient/CurlClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public function testSetRequestStatusCallback()
$curl->setRequestStatusCallback(function ($rbody, $rcode, $rheaders, $errno, $message, $willBeRetried, $numRetries) use (&$called) {
$called = true;

$this->assertInternalType('string', $rbody);
$this->assertIsString($rbody);
$this->assertSame(200, $rcode);
$this->assertSame('req_123', $rheaders['request-id']);
$this->assertSame(0, $errno);
Expand Down
2 changes: 1 addition & 1 deletion tests/Stripe/InvoiceItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIsListable()
'/v1/invoiceitems'
);
$resources = InvoiceItem::all();
static::assertInternalType('array', $resources->data);
static::assertIsArray($resources->data);
static::assertInstanceOf(\Stripe\InvoiceItem::class, $resources->data[0]);
}

Expand Down

0 comments on commit 626be2f

Please sign in to comment.