Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #1135

Merged
merged 2 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add tests for the TaxCode APIs
  • Loading branch information
remi-stripe committed Jun 4, 2021
commit 41be0bc272d6bae061364674f57238f55644d0d5
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
50 changes: 50 additions & 0 deletions tests/Stripe/Service/TaxCodeServiceTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace Stripe\Service;

/**
* @internal
* @covers \Stripe\Service\TaxCodeService
*/
final class TaxCodeServiceTest extends \PHPUnit\Framework\TestCase
{
use \Stripe\TestHelper;

const TEST_RESOURCE_ID = 'txcd_123';

/** @var \Stripe\StripeClient */
private $client;

/** @var TaxCodeService */
private $service;

/**
* @before
*/
protected function setUpService()
{
$this->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);
}
}
35 changes: 35 additions & 0 deletions tests/Stripe/TaxCodeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Stripe;

/**
* @internal
* @covers \Stripe\TaxCode
*/
final class TaxCodeTest extends \PHPUnit\Framework\TestCase
{
use TestHelper;

const TEST_RESOURCE_ID = 'txcd_123';

public function testIsListable()
{
$this->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);
}
}