From 8a0b9c9df46a0e98cc8bbe2624cde3621f2d3cda Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Thu, 3 Jun 2021 19:20:18 -0700 Subject: [PATCH] Add tests for the TaxCode APIs --- .travis.yml | 2 +- tests/Stripe/Service/TaxCodeServiceTest.php | 50 +++++++++++++++++++++ tests/Stripe/TaxCode.php | 35 +++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 tests/Stripe/Service/TaxCodeServiceTest.php create mode 100644 tests/Stripe/TaxCode.php diff --git a/.travis.yml b/.travis.yml index b7e3aa7093..f7ca29f130 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,7 @@ matrix: env: global: - - STRIPE_MOCK_VERSION=0.105.0 + - STRIPE_MOCK_VERSION=0.106.0 cache: directories: - $HOME/.composer/cache/files diff --git a/tests/Stripe/Service/TaxCodeServiceTest.php b/tests/Stripe/Service/TaxCodeServiceTest.php new file mode 100644 index 0000000000..4a4b39df23 --- /dev/null +++ b/tests/Stripe/Service/TaxCodeServiceTest.php @@ -0,0 +1,50 @@ +client = new \Stripe\StripeClient(['api_key' => 'sk_test_123', 'api_base' => MOCK_URL]); + $this->service = new TaxCodeService($this->client); + } + + public function testAll() + { + $this->expectsRequest( + 'get', + '/v1/tax_codes' + ); + $resources = $this->service->all(); + static::assertInternalType('array', $resources->data); + static::assertInstanceOf(\Stripe\TaxCode::class, $resources->data[0]); + } + + public function testRetrieve() + { + $this->expectsRequest( + 'get', + '/v1/tax_codes/' . self::TEST_RESOURCE_ID + ); + $resource = $this->service->retrieve(self::TEST_RESOURCE_ID); + static::assertInstanceOf(\Stripe\TaxCode::class, $resource); + } +} diff --git a/tests/Stripe/TaxCode.php b/tests/Stripe/TaxCode.php new file mode 100644 index 0000000000..744f2529e4 --- /dev/null +++ b/tests/Stripe/TaxCode.php @@ -0,0 +1,35 @@ +expectsRequest( + 'get', + '/v1/tax_codes' + ); + $resources = TaxCode::all(); + static::assertInternalType('array', $resources->data); + static::assertInstanceOf(\Stripe\TaxCode::class, $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/tax_codes/' . self::TEST_RESOURCE_ID + ); + $resource = TaxCode::retrieve(self::TEST_RESOURCE_ID); + static::assertInstanceOf(\Stripe\TaxCode::class, $resource); + } +}