-
Notifications
You must be signed in to change notification settings - Fork 850
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4070e9b
commit 41be0bc
Showing
3 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |