diff --git a/.php_cs.dist b/.php_cs.dist index 02a3637ac..f1e8edbd1 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -15,7 +15,6 @@ return PhpCsFixer\Config::create() 'spacing' => 'one', ], 'ordered_class_elements' => false, - 'php_unit_internal_class' => false, 'php_unit_test_class_requires_covers' => false, 'phpdoc_align' => false, 'protected_to_private' => false, diff --git a/tests/Stripe/AccountLinkTest.php b/tests/Stripe/AccountLinkTest.php index 56a3ae4a1..db4bd7857 100644 --- a/tests/Stripe/AccountLinkTest.php +++ b/tests/Stripe/AccountLinkTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class AccountLinkTest extends TestCase +/** + * @internal + */ +final class AccountLinkTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + public function testIsCreatable() { $this->expectsRequest( diff --git a/tests/Stripe/AccountTest.php b/tests/Stripe/AccountTest.php index 99c65e3cb..b01f50905 100644 --- a/tests/Stripe/AccountTest.php +++ b/tests/Stripe/AccountTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class AccountTest extends TestCase +/** + * @internal + */ +final class AccountTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'acct_123'; const TEST_CAPABILITY_ID = 'acap_123'; const TEST_EXTERNALACCOUNT_ID = 'ba_123'; diff --git a/tests/Stripe/AlipayAccountTest.php b/tests/Stripe/AlipayAccountTest.php index 142e16eba..def6d37b3 100644 --- a/tests/Stripe/AlipayAccountTest.php +++ b/tests/Stripe/AlipayAccountTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class AlipayAccountTest extends TestCase +/** + * @internal + */ +final class AlipayAccountTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'aliacc_123'; // Because of the wildcard nature of sources, stripe-mock cannot currently diff --git a/tests/Stripe/ApiRequestorTest.php b/tests/Stripe/ApiRequestorTest.php index f6931e422..f42d0c12a 100644 --- a/tests/Stripe/ApiRequestorTest.php +++ b/tests/Stripe/ApiRequestorTest.php @@ -4,8 +4,13 @@ use Stripe\HttpClient\CurlClient; -class ApiRequestorTest extends TestCase +/** + * @internal + */ +final class ApiRequestorTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + public function testEncodeObjects() { $reflector = new \ReflectionClass(\Stripe\ApiRequestor::class); diff --git a/tests/Stripe/ApplePayDomainTest.php b/tests/Stripe/ApplePayDomainTest.php index 31cfc9f0b..b8cc189c7 100644 --- a/tests/Stripe/ApplePayDomainTest.php +++ b/tests/Stripe/ApplePayDomainTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class ApplePayDomainTest extends TestCase +/** + * @internal + */ +final class ApplePayDomainTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'apwc_123'; public function testIsListable() diff --git a/tests/Stripe/ApplicationFeeRefundTest.php b/tests/Stripe/ApplicationFeeRefundTest.php index f2fe64943..0f940f06b 100644 --- a/tests/Stripe/ApplicationFeeRefundTest.php +++ b/tests/Stripe/ApplicationFeeRefundTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class ApplicationFeeRefundTest extends TestCase +/** + * @internal + */ +final class ApplicationFeeRefundTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'fr_123'; const TEST_FEE_ID = 'fee_123'; diff --git a/tests/Stripe/ApplicationFeeTest.php b/tests/Stripe/ApplicationFeeTest.php index 00dd68f2c..a4e68d60c 100644 --- a/tests/Stripe/ApplicationFeeTest.php +++ b/tests/Stripe/ApplicationFeeTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class ApplicationFeeTest extends TestCase +/** + * @internal + */ +final class ApplicationFeeTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'fee_123'; const TEST_FEEREFUND_ID = 'fr_123'; diff --git a/tests/Stripe/BalanceTest.php b/tests/Stripe/BalanceTest.php index ada239bb4..25c550da9 100644 --- a/tests/Stripe/BalanceTest.php +++ b/tests/Stripe/BalanceTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class BalanceTest extends TestCase +/** + * @internal + */ +final class BalanceTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + public function testIsRetrievable() { $this->expectsRequest( diff --git a/tests/Stripe/BalanceTransactionTest.php b/tests/Stripe/BalanceTransactionTest.php index 79c9b3ace..85f6b46cd 100644 --- a/tests/Stripe/BalanceTransactionTest.php +++ b/tests/Stripe/BalanceTransactionTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class BalanceTransactionTest extends TestCase +/** + * @internal + */ +final class BalanceTransactionTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'txn_123'; public function testIsListable() diff --git a/tests/Stripe/BankAccountTest.php b/tests/Stripe/BankAccountTest.php index c020e059f..44b7da025 100644 --- a/tests/Stripe/BankAccountTest.php +++ b/tests/Stripe/BankAccountTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class BankAccountTest extends TestCase +/** + * @internal + */ +final class BankAccountTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'ba_123'; // Because of the wildcard nature of sources, stripe-mock cannot currently diff --git a/tests/Stripe/BitcoinReceiverTest.php b/tests/Stripe/BitcoinReceiverTest.php index 670bf72f6..bcc2c2deb 100644 --- a/tests/Stripe/BitcoinReceiverTest.php +++ b/tests/Stripe/BitcoinReceiverTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class BitcoinReceiverTest extends TestCase +/** + * @internal + */ +final class BitcoinReceiverTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'btcrcv_123'; // Because of the wildcard nature of sources, stripe-mock cannot currently diff --git a/tests/Stripe/CapabilityTest.php b/tests/Stripe/CapabilityTest.php index be4890191..a9dcd6b3b 100644 --- a/tests/Stripe/CapabilityTest.php +++ b/tests/Stripe/CapabilityTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class CapabilityTest extends TestCase +/** + * @internal + */ +final class CapabilityTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_ACCOUNT_ID = 'acct_123'; const TEST_RESOURCE_ID = 'acap_123'; diff --git a/tests/Stripe/CardTest.php b/tests/Stripe/CardTest.php index 80d9d0a2a..d42db622a 100644 --- a/tests/Stripe/CardTest.php +++ b/tests/Stripe/CardTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class CardTest extends TestCase +/** + * @internal + */ +final class CardTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'card_123'; // Because of the wildcard nature of sources, stripe-mock cannot currently diff --git a/tests/Stripe/ChargeTest.php b/tests/Stripe/ChargeTest.php index 825a452d9..a36386d01 100644 --- a/tests/Stripe/ChargeTest.php +++ b/tests/Stripe/ChargeTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class ChargeTest extends TestCase +/** + * @internal + */ +final class ChargeTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'ch_123'; public function testIsListable() diff --git a/tests/Stripe/Checkout/SessionTest.php b/tests/Stripe/Checkout/SessionTest.php index 9eab988e9..38edee964 100644 --- a/tests/Stripe/Checkout/SessionTest.php +++ b/tests/Stripe/Checkout/SessionTest.php @@ -2,8 +2,13 @@ namespace Stripe\Checkout; -class SessionTest extends \Stripe\TestCase +/** + * @internal + */ +final class SessionTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'cs_123'; public function testIsCreatable() diff --git a/tests/Stripe/CollectionTest.php b/tests/Stripe/CollectionTest.php index 1b2049e06..38ee133f9 100644 --- a/tests/Stripe/CollectionTest.php +++ b/tests/Stripe/CollectionTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class CollectionTest extends TestCase +/** + * @internal + */ +final class CollectionTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + /** @var \Stripe\Collection */ private $fixture; diff --git a/tests/Stripe/CountrySpecTest.php b/tests/Stripe/CountrySpecTest.php index 86ad1b920..f4bbeae38 100644 --- a/tests/Stripe/CountrySpecTest.php +++ b/tests/Stripe/CountrySpecTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class CountrySpecTest extends TestCase +/** + * @internal + */ +final class CountrySpecTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'US'; public function testIsListable() diff --git a/tests/Stripe/CouponTest.php b/tests/Stripe/CouponTest.php index af07ae258..9b300f685 100644 --- a/tests/Stripe/CouponTest.php +++ b/tests/Stripe/CouponTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class CouponTest extends TestCase +/** + * @internal + */ +final class CouponTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = '25OFF'; public function testIsListable() diff --git a/tests/Stripe/CreditNoteTest.php b/tests/Stripe/CreditNoteTest.php index 4b9bd7be4..410d0d67d 100644 --- a/tests/Stripe/CreditNoteTest.php +++ b/tests/Stripe/CreditNoteTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class CreditNoteTest extends TestCase +/** + * @internal + */ +final class CreditNoteTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'cn_123'; public function testIsListable() diff --git a/tests/Stripe/CustomerBalanceTransactionTest.php b/tests/Stripe/CustomerBalanceTransactionTest.php index bc9fdd6f4..f8bf53133 100644 --- a/tests/Stripe/CustomerBalanceTransactionTest.php +++ b/tests/Stripe/CustomerBalanceTransactionTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class CustomerBalanceTransactionTest extends TestCase +/** + * @internal + */ +final class CustomerBalanceTransactionTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_CUSTOMER_ID = 'cus_123'; const TEST_RESOURCE_ID = 'cbtxn_123'; diff --git a/tests/Stripe/CustomerTest.php b/tests/Stripe/CustomerTest.php index 6c8f2efc2..3a0095042 100644 --- a/tests/Stripe/CustomerTest.php +++ b/tests/Stripe/CustomerTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class CustomerTest extends TestCase +/** + * @internal + */ +final class CustomerTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'cus_123'; const TEST_SOURCE_ID = 'ba_123'; const TEST_TAX_ID_ID = 'txi_123'; diff --git a/tests/Stripe/DisputeTest.php b/tests/Stripe/DisputeTest.php index 5fb2af9cb..666e7b7bc 100644 --- a/tests/Stripe/DisputeTest.php +++ b/tests/Stripe/DisputeTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class DisputeTest extends TestCase +/** + * @internal + */ +final class DisputeTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'dp_123'; public function testIsListable() diff --git a/tests/Stripe/EphemeralKeyTest.php b/tests/Stripe/EphemeralKeyTest.php index 57556d615..0567b6135 100644 --- a/tests/Stripe/EphemeralKeyTest.php +++ b/tests/Stripe/EphemeralKeyTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class EphemeralKeyTest extends TestCase +/** + * @internal + */ +final class EphemeralKeyTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + public function testIsCreatable() { $this->expectsRequest( diff --git a/tests/Stripe/ErrorObjectTest.php b/tests/Stripe/ErrorObjectTest.php index 1699f9055..78a4b5d77 100644 --- a/tests/Stripe/ErrorObjectTest.php +++ b/tests/Stripe/ErrorObjectTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class ErrorObjectTest extends TestCase +/** + * @internal + */ +final class ErrorObjectTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + public function testDefaultValues() { $error = ErrorObject::constructFrom([]); diff --git a/tests/Stripe/EventTest.php b/tests/Stripe/EventTest.php index 428908a41..837fe7ee3 100644 --- a/tests/Stripe/EventTest.php +++ b/tests/Stripe/EventTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class EventTest extends TestCase +/** + * @internal + */ +final class EventTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'evt_123'; public function testIsListable() diff --git a/tests/Stripe/Exception/ApiErrorExceptionTest.php b/tests/Stripe/Exception/ApiErrorExceptionTest.php index ea0634bca..3f362244f 100644 --- a/tests/Stripe/Exception/ApiErrorExceptionTest.php +++ b/tests/Stripe/Exception/ApiErrorExceptionTest.php @@ -2,8 +2,13 @@ namespace Stripe\Exception; -class ApiErrorExceptionTest extends \Stripe\TestCase +/** + * @internal + */ +final class ApiErrorExceptionTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + public function createFixture() { $mock = $this->getMockForAbstractClass(ApiErrorException::class); diff --git a/tests/Stripe/Exception/OAuth/OAuthErrorExceptionTest.php b/tests/Stripe/Exception/OAuth/OAuthErrorExceptionTest.php index baade6ae9..d270bc78e 100644 --- a/tests/Stripe/Exception/OAuth/OAuthErrorExceptionTest.php +++ b/tests/Stripe/Exception/OAuth/OAuthErrorExceptionTest.php @@ -2,8 +2,13 @@ namespace Stripe\Exception\OAuth; -class OAuthErrorExceptionTest extends \Stripe\TestCase +/** + * @internal + */ +final class OAuthErrorExceptionTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + public function createFixture() { $mock = $this->getMockForAbstractClass(OAuthErrorException::class); diff --git a/tests/Stripe/Exception/SignatureVerificationExceptionTest.php b/tests/Stripe/Exception/SignatureVerificationExceptionTest.php index 165497f3b..3d3f3ed03 100644 --- a/tests/Stripe/Exception/SignatureVerificationExceptionTest.php +++ b/tests/Stripe/Exception/SignatureVerificationExceptionTest.php @@ -2,8 +2,13 @@ namespace Stripe\Exception; -class SignatureVerificationExceptionTest extends \Stripe\TestCase +/** + * @internal + */ +final class SignatureVerificationExceptionTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + public function testGetters() { $e = SignatureVerificationException::factory('message', 'payload', 'sig_header'); diff --git a/tests/Stripe/ExchangeRateTest.php b/tests/Stripe/ExchangeRateTest.php index b396faf28..24a14cd28 100644 --- a/tests/Stripe/ExchangeRateTest.php +++ b/tests/Stripe/ExchangeRateTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class ExchangeRateTest extends TestCase +/** + * @internal + */ +final class ExchangeRateTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + public function testIsListable() { $this->stubRequest( diff --git a/tests/Stripe/FileCreationTest.php b/tests/Stripe/FileCreationTest.php index e594521d9..a100e7972 100644 --- a/tests/Stripe/FileCreationTest.php +++ b/tests/Stripe/FileCreationTest.php @@ -6,24 +6,30 @@ * These tests should really be part of `FileTest`, but because the file creation requests use a * different host, the tests for these methods need their own setup and teardown methods. */ -class FileCreationTest extends TestCase +/** + * @internal + */ +final class FileCreationTest extends \PHPUnit\Framework\TestCase { - /** - * @before - */ + use TestHelper; + + private $origApiUploadBase; + + /** @before */ public function setUpUploadBase() { - Stripe::$apiUploadBase = Stripe::$apiBase; + $this->origApiBase = Stripe::$apiBase; + $this->origApiUploadBase = Stripe::$apiUploadBase; + + Stripe::$apiUploadBase = \defined('MOCK_URL') ? MOCK_URL : 'http://localhost:12111'; Stripe::$apiBase = null; } - /** - * @after - */ + /** @after */ public function tearDownUploadBase() { - Stripe::$apiBase = Stripe::$apiUploadBase; - Stripe::$apiUploadBase = 'https://files.stripe.com'; + Stripe::$apiBase = $this->origApiBase; + Stripe::$apiUploadBase = $this->origApiUploadBase; } public function testIsCreatableWithFileHandle() diff --git a/tests/Stripe/FileLinkTest.php b/tests/Stripe/FileLinkTest.php index 2f0c4641e..a7a1b95f1 100644 --- a/tests/Stripe/FileLinkTest.php +++ b/tests/Stripe/FileLinkTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class FileLinkTest extends TestCase +/** + * @internal + */ +final class FileLinkTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'link_123'; public function testIsListable() diff --git a/tests/Stripe/FileTest.php b/tests/Stripe/FileTest.php index 28f88224a..a2715bdf9 100644 --- a/tests/Stripe/FileTest.php +++ b/tests/Stripe/FileTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class FileTest extends TestCase +/** + * @internal + */ +final class FileTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'file_123'; public function testIsListable() diff --git a/tests/Stripe/HttpClient/CurlClientTest.php b/tests/Stripe/HttpClient/CurlClientTest.php index 1596590a9..86c2f71e6 100644 --- a/tests/Stripe/HttpClient/CurlClientTest.php +++ b/tests/Stripe/HttpClient/CurlClientTest.php @@ -2,8 +2,13 @@ namespace Stripe\HttpClient; -class CurlClientTest extends \Stripe\TestCase +/** + * @internal + */ +final class CurlClientTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + /** @var \ReflectionProperty */ private $initialNetworkRetryDelayProperty; diff --git a/tests/Stripe/InvoiceItemTest.php b/tests/Stripe/InvoiceItemTest.php index e55b1bdbd..d62b59088 100644 --- a/tests/Stripe/InvoiceItemTest.php +++ b/tests/Stripe/InvoiceItemTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class InvoiceItemTest extends TestCase +/** + * @internal + */ +final class InvoiceItemTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'ii_123'; public function testIsListable() diff --git a/tests/Stripe/InvoiceTest.php b/tests/Stripe/InvoiceTest.php index 5d5219319..cf2109a01 100644 --- a/tests/Stripe/InvoiceTest.php +++ b/tests/Stripe/InvoiceTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class InvoiceTest extends TestCase +/** + * @internal + */ +final class InvoiceTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'in_123'; const TEST_LINE_ID = 'ii_123'; diff --git a/tests/Stripe/Issuing/AuthorizationTest.php b/tests/Stripe/Issuing/AuthorizationTest.php index 8f6aabc02..af48a9e9f 100644 --- a/tests/Stripe/Issuing/AuthorizationTest.php +++ b/tests/Stripe/Issuing/AuthorizationTest.php @@ -2,8 +2,13 @@ namespace Stripe\Issuing; -class AuthorizationTest extends \Stripe\TestCase +/** + * @internal + */ +final class AuthorizationTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'iauth_123'; public function testIsListable() diff --git a/tests/Stripe/Issuing/CardTest.php b/tests/Stripe/Issuing/CardTest.php index 325979f9f..370a317c1 100644 --- a/tests/Stripe/Issuing/CardTest.php +++ b/tests/Stripe/Issuing/CardTest.php @@ -2,8 +2,13 @@ namespace Stripe\Issuing; -class CardTest extends \Stripe\TestCase +/** + * @internal + */ +final class CardTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'ic_123'; public function testIsListable() diff --git a/tests/Stripe/Issuing/CardholderTest.php b/tests/Stripe/Issuing/CardholderTest.php index 48f492439..94041edf2 100644 --- a/tests/Stripe/Issuing/CardholderTest.php +++ b/tests/Stripe/Issuing/CardholderTest.php @@ -2,8 +2,13 @@ namespace Stripe\Issuing; -class CardholderTest extends \Stripe\TestCase +/** + * @internal + */ +final class CardholderTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'ich_123'; public function testIsCreatable() diff --git a/tests/Stripe/Issuing/DisputeTest.php b/tests/Stripe/Issuing/DisputeTest.php index 57b32c7fd..6c96409af 100644 --- a/tests/Stripe/Issuing/DisputeTest.php +++ b/tests/Stripe/Issuing/DisputeTest.php @@ -2,8 +2,13 @@ namespace Stripe\Issuing; -class DisputeTest extends \Stripe\TestCase +/** + * @internal + */ +final class DisputeTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'idp_123'; public function testIsCreatable() diff --git a/tests/Stripe/Issuing/TransactionTest.php b/tests/Stripe/Issuing/TransactionTest.php index effbaae59..621f1a24c 100644 --- a/tests/Stripe/Issuing/TransactionTest.php +++ b/tests/Stripe/Issuing/TransactionTest.php @@ -2,8 +2,13 @@ namespace Stripe\Issuing; -class TransactionTest extends \Stripe\TestCase +/** + * @internal + */ +final class TransactionTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'ipi_123'; public function testIsListable() diff --git a/tests/Stripe/MandateTest.php b/tests/Stripe/MandateTest.php index 7e5244a64..114c9d411 100644 --- a/tests/Stripe/MandateTest.php +++ b/tests/Stripe/MandateTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class MandateTest extends TestCase +/** + * @internal + */ +final class MandateTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'mandate_123'; public function testIsRetrievable() diff --git a/tests/Stripe/OAuthErrorObjectTest.php b/tests/Stripe/OAuthErrorObjectTest.php index 73b27e147..3b36860d4 100644 --- a/tests/Stripe/OAuthErrorObjectTest.php +++ b/tests/Stripe/OAuthErrorObjectTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class OAuthErrorObjectTest extends TestCase +/** + * @internal + */ +final class OAuthErrorObjectTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + public function testDefaultValues() { $error = OAuthErrorObject::constructFrom([]); diff --git a/tests/Stripe/OAuthTest.php b/tests/Stripe/OAuthTest.php index a7beea953..f733e78fc 100644 --- a/tests/Stripe/OAuthTest.php +++ b/tests/Stripe/OAuthTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class OAuthTest extends TestCase +/** + * @internal + */ +final class OAuthTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + public function testAuthorizeUrl() { $uriStr = OAuth::authorizeUrl([ diff --git a/tests/Stripe/OrderReturnTest.php b/tests/Stripe/OrderReturnTest.php index 1351030a9..6c8da0a3a 100644 --- a/tests/Stripe/OrderReturnTest.php +++ b/tests/Stripe/OrderReturnTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class OrderReturnTest extends TestCase +/** + * @internal + */ +final class OrderReturnTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'orret_123'; public function testIsListable() diff --git a/tests/Stripe/OrderTest.php b/tests/Stripe/OrderTest.php index c22183a8f..89b3a2929 100644 --- a/tests/Stripe/OrderTest.php +++ b/tests/Stripe/OrderTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class OrderTest extends TestCase +/** + * @internal + */ +final class OrderTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'or_123'; public function testIsListable() diff --git a/tests/Stripe/PaymentIntentTest.php b/tests/Stripe/PaymentIntentTest.php index 3a77225a7..a13f1b553 100644 --- a/tests/Stripe/PaymentIntentTest.php +++ b/tests/Stripe/PaymentIntentTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class PaymentIntentTest extends TestCase +/** + * @internal + */ +final class PaymentIntentTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'pi_123'; public function testIsListable() diff --git a/tests/Stripe/PaymentMethodTest.php b/tests/Stripe/PaymentMethodTest.php index 889cd409f..ca656e159 100644 --- a/tests/Stripe/PaymentMethodTest.php +++ b/tests/Stripe/PaymentMethodTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class PaymentMethodTest extends TestCase +/** + * @internal + */ +final class PaymentMethodTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'pm_123'; public function testIsListable() diff --git a/tests/Stripe/PayoutTest.php b/tests/Stripe/PayoutTest.php index 1ac518622..c944ebb47 100644 --- a/tests/Stripe/PayoutTest.php +++ b/tests/Stripe/PayoutTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class PayoutTest extends TestCase +/** + * @internal + */ +final class PayoutTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'po_123'; public function testIsListable() diff --git a/tests/Stripe/PersonTest.php b/tests/Stripe/PersonTest.php index fb88ddbe5..81d8ef524 100644 --- a/tests/Stripe/PersonTest.php +++ b/tests/Stripe/PersonTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class PersonTest extends TestCase +/** + * @internal + */ +final class PersonTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_ACCOUNT_ID = 'acct_123'; const TEST_RESOURCE_ID = 'person_123'; diff --git a/tests/Stripe/PlanTest.php b/tests/Stripe/PlanTest.php index 783660641..a486c4c86 100644 --- a/tests/Stripe/PlanTest.php +++ b/tests/Stripe/PlanTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class PlanTest extends TestCase +/** + * @internal + */ +final class PlanTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'plan'; public function testIsListable() diff --git a/tests/Stripe/ProductTest.php b/tests/Stripe/ProductTest.php index 011ab8d31..3bd70863a 100644 --- a/tests/Stripe/ProductTest.php +++ b/tests/Stripe/ProductTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class ProductTest extends TestCase +/** + * @internal + */ +final class ProductTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'prod_123'; public function testIsListable() diff --git a/tests/Stripe/Radar/EarlyFraudWarningTest.php b/tests/Stripe/Radar/EarlyFraudWarningTest.php index 19b28c66a..c929c4776 100644 --- a/tests/Stripe/Radar/EarlyFraudWarningTest.php +++ b/tests/Stripe/Radar/EarlyFraudWarningTest.php @@ -2,8 +2,13 @@ namespace Stripe\Radar; -class EarlyFraudWarningTest extends \Stripe\TestCase +/** + * @internal + */ +final class EarlyFraudWarningTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'issfr_123'; public function testIsListable() diff --git a/tests/Stripe/Radar/ValueListItemTest.php b/tests/Stripe/Radar/ValueListItemTest.php index f7295ffc9..ab0b758a3 100644 --- a/tests/Stripe/Radar/ValueListItemTest.php +++ b/tests/Stripe/Radar/ValueListItemTest.php @@ -2,8 +2,13 @@ namespace Stripe\Radar; -class ValueListItemTest extends \Stripe\TestCase +/** + * @internal + */ +final class ValueListItemTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'rsli_123'; public function testIsListable() diff --git a/tests/Stripe/Radar/ValueListTest.php b/tests/Stripe/Radar/ValueListTest.php index beb997ae8..98ca1ede7 100644 --- a/tests/Stripe/Radar/ValueListTest.php +++ b/tests/Stripe/Radar/ValueListTest.php @@ -2,8 +2,13 @@ namespace Stripe\Radar; -class ValueListTest extends \Stripe\TestCase +/** + * @internal + */ +final class ValueListTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'rsl_123'; public function testIsListable() diff --git a/tests/Stripe/RecipientTest.php b/tests/Stripe/RecipientTest.php index c8657a088..9eea8ba22 100644 --- a/tests/Stripe/RecipientTest.php +++ b/tests/Stripe/RecipientTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class RecipientTest extends TestCase +/** + * @internal + */ +final class RecipientTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'rp_123'; public function testIsListable() diff --git a/tests/Stripe/RefundTest.php b/tests/Stripe/RefundTest.php index 1fcf563f9..8ef93e9ae 100644 --- a/tests/Stripe/RefundTest.php +++ b/tests/Stripe/RefundTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class RefundTest extends TestCase +/** + * @internal + */ +final class RefundTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 're_123'; public function testIsListable() diff --git a/tests/Stripe/Reporting/ReportRunTest.php b/tests/Stripe/Reporting/ReportRunTest.php index be44cc2ca..5b6a2e868 100644 --- a/tests/Stripe/Reporting/ReportRunTest.php +++ b/tests/Stripe/Reporting/ReportRunTest.php @@ -2,8 +2,13 @@ namespace Stripe\Reporting; -class ReportRunTest extends \Stripe\TestCase +/** + * @internal + */ +final class ReportRunTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'frr_123'; public function testIsCreatable() diff --git a/tests/Stripe/Reporting/ReportTypeTest.php b/tests/Stripe/Reporting/ReportTypeTest.php index 3486d7d75..bbae90340 100644 --- a/tests/Stripe/Reporting/ReportTypeTest.php +++ b/tests/Stripe/Reporting/ReportTypeTest.php @@ -2,8 +2,13 @@ namespace Stripe\Reporting; -class ReportTypeTest extends \Stripe\TestCase +/** + * @internal + */ +final class ReportTypeTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'activity.summary.1'; public function testIsListable() diff --git a/tests/Stripe/ReviewTest.php b/tests/Stripe/ReviewTest.php index aa9fb8ace..3fb7c30f1 100644 --- a/tests/Stripe/ReviewTest.php +++ b/tests/Stripe/ReviewTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class ReviewTest extends \Stripe\TestCase +/** + * @internal + */ +final class ReviewTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'prv_123'; public function testIsApprovable() diff --git a/tests/Stripe/SKUTest.php b/tests/Stripe/SKUTest.php index 1792ec415..c87ebe9a3 100644 --- a/tests/Stripe/SKUTest.php +++ b/tests/Stripe/SKUTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class SKUTest extends TestCase +/** + * @internal + */ +final class SKUTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'sku_123'; public function testIsListable() diff --git a/tests/Stripe/SetupIntentTest.php b/tests/Stripe/SetupIntentTest.php index daf3e5792..d40380878 100644 --- a/tests/Stripe/SetupIntentTest.php +++ b/tests/Stripe/SetupIntentTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class SetupIntentTest extends TestCase +/** + * @internal + */ +final class SetupIntentTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'seti_123'; public function testIsListable() diff --git a/tests/Stripe/Sigma/ScheduledQueryRunTest.php b/tests/Stripe/Sigma/ScheduledQueryRunTest.php index 1d345fbf4..9540855fa 100644 --- a/tests/Stripe/Sigma/ScheduledQueryRunTest.php +++ b/tests/Stripe/Sigma/ScheduledQueryRunTest.php @@ -2,8 +2,13 @@ namespace Stripe\Sigma; -class ScheduledQueryRunTest extends \Stripe\TestCase +/** + * @internal + */ +final class ScheduledQueryRunTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'sqr_123'; public function testIsListable() diff --git a/tests/Stripe/SourceTest.php b/tests/Stripe/SourceTest.php index b45565b53..93f9db125 100644 --- a/tests/Stripe/SourceTest.php +++ b/tests/Stripe/SourceTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class SourceTest extends TestCase +/** + * @internal + */ +final class SourceTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'src_123'; public function testIsRetrievable() diff --git a/tests/Stripe/StripeObjectTest.php b/tests/Stripe/StripeObjectTest.php index 4033b1e67..c2719c6ed 100644 --- a/tests/Stripe/StripeObjectTest.php +++ b/tests/Stripe/StripeObjectTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class StripeObjectTest extends TestCase +/** + * @internal + */ +final class StripeObjectTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + /** @var \ReflectionMethod */ private $deepCopyReflector; diff --git a/tests/Stripe/StripeTelemetryTest.php b/tests/Stripe/StripeTelemetryTest.php index ec64aa4a1..f9e8dbc97 100644 --- a/tests/Stripe/StripeTelemetryTest.php +++ b/tests/Stripe/StripeTelemetryTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class StripeTelemetryTest extends TestCase +/** + * @internal + */ +final class StripeTelemetryTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'acct_123'; const TEST_EXTERNALACCOUNT_ID = 'ba_123'; const TEST_PERSON_ID = 'person_123'; @@ -17,8 +22,6 @@ class StripeTelemetryTest extends TestCase protected function setUp() { - parent::setUp(); - // clear static telemetry data ApiRequestor::resetTelemetry(); } diff --git a/tests/Stripe/StripeTest.php b/tests/Stripe/StripeTest.php index 8d5c0d83c..32ceb3fe2 100644 --- a/tests/Stripe/StripeTest.php +++ b/tests/Stripe/StripeTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class StripeTest extends TestCase +/** + * @internal + */ +final class StripeTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + /** @var array */ protected $orig; diff --git a/tests/Stripe/SubscriptionItemTest.php b/tests/Stripe/SubscriptionItemTest.php index 7505881d0..6df6eb8de 100644 --- a/tests/Stripe/SubscriptionItemTest.php +++ b/tests/Stripe/SubscriptionItemTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class SubscriptionItemTest extends TestCase +/** + * @internal + */ +final class SubscriptionItemTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'si_123'; public function testIsListable() diff --git a/tests/Stripe/SubscriptionScheduleTest.php b/tests/Stripe/SubscriptionScheduleTest.php index fafa88d3a..d0da6a1fb 100644 --- a/tests/Stripe/SubscriptionScheduleTest.php +++ b/tests/Stripe/SubscriptionScheduleTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class SubscriptionScheduleTest extends TestCase +/** + * @internal + */ +final class SubscriptionScheduleTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'sub_sched_123'; const TEST_REVISION_ID = 'sub_sched_rev_123'; diff --git a/tests/Stripe/SubscriptionTest.php b/tests/Stripe/SubscriptionTest.php index 4bd8ffee5..e5f69b931 100644 --- a/tests/Stripe/SubscriptionTest.php +++ b/tests/Stripe/SubscriptionTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class SubscriptionTest extends TestCase +/** + * @internal + */ +final class SubscriptionTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'sub_123'; public function testIsListable() diff --git a/tests/Stripe/TaxIdTest.php b/tests/Stripe/TaxIdTest.php index 607f870f1..0907b1b0b 100644 --- a/tests/Stripe/TaxIdTest.php +++ b/tests/Stripe/TaxIdTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class TaxIdTest extends TestCase +/** + * @internal + */ +final class TaxIdTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_CUSTOMER_ID = 'cus_123'; const TEST_RESOURCE_ID = 'txi_123'; diff --git a/tests/Stripe/TaxRateTest.php b/tests/Stripe/TaxRateTest.php index fe45f2cb7..3d283ff23 100644 --- a/tests/Stripe/TaxRateTest.php +++ b/tests/Stripe/TaxRateTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class TaxRateTest extends TestCase +/** + * @internal + */ +final class TaxRateTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'txr_123'; public function testIsListable() diff --git a/tests/Stripe/Terminal/ConnectionTokenTest.php b/tests/Stripe/Terminal/ConnectionTokenTest.php index db6dfda4e..f581ed16e 100644 --- a/tests/Stripe/Terminal/ConnectionTokenTest.php +++ b/tests/Stripe/Terminal/ConnectionTokenTest.php @@ -2,8 +2,13 @@ namespace Stripe\Terminal; -class ConnectionTokenTest extends \Stripe\TestCase +/** + * @internal + */ +final class ConnectionTokenTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + public function testIsCreatable() { $this->expectsRequest( diff --git a/tests/Stripe/Terminal/LocationTest.php b/tests/Stripe/Terminal/LocationTest.php index bdbaf63f9..57fe97902 100644 --- a/tests/Stripe/Terminal/LocationTest.php +++ b/tests/Stripe/Terminal/LocationTest.php @@ -2,8 +2,13 @@ namespace Stripe\Terminal; -class LocationTest extends \Stripe\TestCase +/** + * @internal + */ +final class LocationTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'loc_123'; public function testIsListable() diff --git a/tests/Stripe/Terminal/ReaderTest.php b/tests/Stripe/Terminal/ReaderTest.php index 01b1f7ca3..486f9c673 100644 --- a/tests/Stripe/Terminal/ReaderTest.php +++ b/tests/Stripe/Terminal/ReaderTest.php @@ -2,8 +2,13 @@ namespace Stripe\Terminal; -class ReaderTest extends \Stripe\TestCase +/** + * @internal + */ +final class ReaderTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + const TEST_RESOURCE_ID = 'rdr_123'; public function testIsListable() diff --git a/tests/Stripe/ThreeDSecureTest.php b/tests/Stripe/ThreeDSecureTest.php index 0d4cdd683..7db60b6c7 100644 --- a/tests/Stripe/ThreeDSecureTest.php +++ b/tests/Stripe/ThreeDSecureTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class ThreeDSecureTest extends TestCase +/** + * @internal + */ +final class ThreeDSecureTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'tdsrc_123'; public function testIsRetrievable() diff --git a/tests/Stripe/TokenTest.php b/tests/Stripe/TokenTest.php index 02c4b698b..c35c9ddfd 100644 --- a/tests/Stripe/TokenTest.php +++ b/tests/Stripe/TokenTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class TokenTest extends TestCase +/** + * @internal + */ +final class TokenTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'tok_123'; public function testIsRetrievable() diff --git a/tests/Stripe/TopupTest.php b/tests/Stripe/TopupTest.php index 7a813001b..18b3bf03a 100644 --- a/tests/Stripe/TopupTest.php +++ b/tests/Stripe/TopupTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class TopupTest extends TestCase +/** + * @internal + */ +final class TopupTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'tu_123'; public function testIsListable() diff --git a/tests/Stripe/TransferReversalTest.php b/tests/Stripe/TransferReversalTest.php index b509b5630..4fb2629b1 100644 --- a/tests/Stripe/TransferReversalTest.php +++ b/tests/Stripe/TransferReversalTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class TransferReversalTest extends TestCase +/** + * @internal + */ +final class TransferReversalTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'trr_123'; const TEST_TRANSFER_ID = 'tr_123'; diff --git a/tests/Stripe/TransferTest.php b/tests/Stripe/TransferTest.php index e9d5ee054..8211ca11b 100644 --- a/tests/Stripe/TransferTest.php +++ b/tests/Stripe/TransferTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class TransferTest extends TestCase +/** + * @internal + */ +final class TransferTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'tr_123'; const TEST_REVERSAL_ID = 'trr_123'; diff --git a/tests/Stripe/Util/CaseInsensitiveArrayTest.php b/tests/Stripe/Util/CaseInsensitiveArrayTest.php index 3984c0f63..942e7744b 100644 --- a/tests/Stripe/Util/CaseInsensitiveArrayTest.php +++ b/tests/Stripe/Util/CaseInsensitiveArrayTest.php @@ -2,8 +2,13 @@ namespace Stripe\Util; -class CaseInsensitiveArrayTest extends \Stripe\TestCase +/** + * @internal + */ +final class CaseInsensitiveArrayTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + public function testArrayAccess() { $arr = new CaseInsensitiveArray(['One' => '1', 'TWO' => '2']); diff --git a/tests/Stripe/Util/DefaultLoggerTest.php b/tests/Stripe/Util/DefaultLoggerTest.php index 4877eb816..af3bdfc14 100644 --- a/tests/Stripe/Util/DefaultLoggerTest.php +++ b/tests/Stripe/Util/DefaultLoggerTest.php @@ -2,8 +2,13 @@ namespace Stripe\Util; -class DefaultLoggerTest extends \Stripe\TestCase +/** + * @internal + */ +final class DefaultLoggerTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + public function testDefaultLogger() { // DefaultLogger uses PHP's `error_log` function. In order to capture diff --git a/tests/Stripe/Util/RequestOptionsTest.php b/tests/Stripe/Util/RequestOptionsTest.php index 2be2298ff..084f0dd2a 100644 --- a/tests/Stripe/Util/RequestOptionsTest.php +++ b/tests/Stripe/Util/RequestOptionsTest.php @@ -2,8 +2,13 @@ namespace Stripe\Util; -class RequestOptionsTest extends \Stripe\TestCase +/** + * @internal + */ +final class RequestOptionsTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + public function testStringAPIKey() { $opts = RequestOptions::parse('foo'); diff --git a/tests/Stripe/Util/UtilTest.php b/tests/Stripe/Util/UtilTest.php index daad330d1..95760f632 100644 --- a/tests/Stripe/Util/UtilTest.php +++ b/tests/Stripe/Util/UtilTest.php @@ -2,8 +2,13 @@ namespace Stripe\Util; -class UtilTest extends \Stripe\TestCase +/** + * @internal + */ +final class UtilTest extends \PHPUnit\Framework\TestCase { + use \Stripe\TestHelper; + public function testIsList() { $list = [5, 'nstaoush', []]; diff --git a/tests/Stripe/WebhookEndpointTest.php b/tests/Stripe/WebhookEndpointTest.php index 07471d45e..4253f4a82 100644 --- a/tests/Stripe/WebhookEndpointTest.php +++ b/tests/Stripe/WebhookEndpointTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class WebhookEndpointTest extends TestCase +/** + * @internal + */ +final class WebhookEndpointTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const TEST_RESOURCE_ID = 'we_123'; public function testIsListable() diff --git a/tests/Stripe/WebhookTest.php b/tests/Stripe/WebhookTest.php index 6c91d0229..ed2519a61 100644 --- a/tests/Stripe/WebhookTest.php +++ b/tests/Stripe/WebhookTest.php @@ -2,8 +2,13 @@ namespace Stripe; -class WebhookTest extends TestCase +/** + * @internal + */ +final class WebhookTest extends \PHPUnit\Framework\TestCase { + use TestHelper; + const EVENT_PAYLOAD = '{ "id": "evt_test_webhook", "object": "event" diff --git a/tests/TestCase.php b/tests/TestHelper.php similarity index 97% rename from tests/TestCase.php rename to tests/TestHelper.php index 442d6d902..94ea58069 100644 --- a/tests/TestCase.php +++ b/tests/TestHelper.php @@ -3,9 +3,9 @@ namespace Stripe; /** - * Base class for Stripe test cases. + * Helper trait for Stripe test cases. */ -class TestCase extends \PHPUnit\Framework\TestCase +trait TestHelper { /** @var string original API base URL */ protected $origApiBase; @@ -25,7 +25,8 @@ class TestCase extends \PHPUnit\Framework\TestCase /** @var object HTTP client mocker */ protected $clientMock; - protected function setUp() + /** @before */ + protected function setUpConfig() { // Save original values so that we can restore them after running tests $this->origApiBase = Stripe::$apiBase; @@ -48,7 +49,8 @@ protected function setUp() ApiRequestor::setHttpClient(HttpClient\CurlClient::instance()); } - protected function tearDown() + /** @after */ + protected function tearDownConfig() { // Restore original values Stripe::$apiBase = $this->origApiBase; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 2f05295c6..dd3443684 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -53,4 +53,4 @@ exit(1); } -require_once __DIR__ . '/TestCase.php'; +require_once __DIR__ . '/TestHelper.php';