Skip to content

Commit

Permalink
chore: Update some tests
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Gaspar <[email protected]>
  • Loading branch information
brunogaspar committed Dec 21, 2019
1 parent 74644ce commit 8e480e3
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 33 deletions.
2 changes: 2 additions & 0 deletions tests/Api/Account/CapabilitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function it_can_find_an_existing_capability()
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

Expand Down Expand Up @@ -74,6 +75,7 @@ public function it_can_update_a_capability()
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

Expand Down
44 changes: 37 additions & 7 deletions tests/Api/Account/PersonsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ public function it_can_create_a_new_person()
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$person = $this->stripe->account()->persons()->create($account['id'], [
Expand All @@ -49,7 +54,12 @@ public function it_can_find_an_existing_person()
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$person = $this->stripe->account()->persons()->create($account['id'], [
Expand All @@ -73,7 +83,12 @@ public function it_will_throw_an_exception_when_searching_for_a_non_existing_per
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$this->stripe->account()->persons()->find($account['id'], time().rand());
Expand All @@ -85,7 +100,12 @@ public function it_can_update_a_person()
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$person = $this->stripe->account()->persons()->create($account['id'], [
Expand All @@ -108,7 +128,12 @@ public function it_can_delete_a_person()
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$person = $this->stripe->account()->persons()->create($account['id'], [
Expand All @@ -128,7 +153,12 @@ public function it_can_retrieve_all_persons()
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$this->stripe->account()->persons()->create($account['id'], [
Expand All @@ -138,7 +168,7 @@ public function it_can_retrieve_all_persons()

$persons = $this->stripe->account()->persons()->all($account['id']);

$this->assertCount(2, $persons['data']);
$this->assertNotEmpty($persons['data']);
$this->assertInternalType('array', $persons['data']);
}
}
56 changes: 48 additions & 8 deletions tests/Api/AccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ public function it_can_create_a_new_account()
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$this->assertSame($email, $account['email']);
Expand All @@ -52,7 +57,12 @@ public function it_can_retrieve_an_account()
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$email = $account['email'];
Expand All @@ -72,7 +82,12 @@ public function it_can_update_an_account()
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accountId = $account['id'];
Expand All @@ -94,7 +109,12 @@ public function it_can_reject_an_account()
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accountId = $account['id'];
Expand All @@ -112,7 +132,12 @@ public function it_can_retrieve_all_accounts()
$email = $this->getRandomEmail();

$this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accounts = $this->stripe->account()->all();
Expand All @@ -127,7 +152,12 @@ public function it_can_iterate_all_accounts()
$email = $this->getRandomEmail();

$this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accounts = $this->stripe->accountIterator();
Expand All @@ -141,7 +171,12 @@ public function it_can_use_an_account_to_perform_actions()
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accountId = $account['id'];
Expand All @@ -161,7 +196,12 @@ public function it_can_delete_an_account()
$email = $this->getRandomEmail();

$account = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accountId = $account['id'];
Expand Down
78 changes: 60 additions & 18 deletions tests/Api/ExternalAccountsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,16 @@ public function it_can_create_a_new_bank_account()
{
$email = $this->getRandomEmail();

$accountId = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
])['id'];
$account = $this->stripe->account()->create([
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accountId = $account['id'];

$token = $this->createBankAccountToken();

Expand All @@ -48,9 +55,16 @@ public function it_can_retrieve_an_existing_bank_account()
{
$email = $this->getRandomEmail();

$accountId = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
])['id'];
$account = $this->stripe->account()->create([
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accountId = $account['id'];

$token = $this->createBankAccountToken();

Expand All @@ -69,9 +83,16 @@ public function it_can_update_an_existing_bank_account()
{
$email = $this->getRandomEmail();

$accountId = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
])['id'];
$account = $this->stripe->account()->create([
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accountId = $account['id'];

$token = $this->createBankAccountToken();

Expand All @@ -93,9 +114,16 @@ public function it_can_delete_an_existing_bank_account()
{
$email = $this->getRandomEmail();

$accountId = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
])['id'];
$account = $this->stripe->account()->create([
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accountId = $account['id'];

$token = $this->createBankAccountToken();

Expand All @@ -119,9 +147,16 @@ public function it_can_retrieve_all_bank_accounts()
{
$email = $this->getRandomEmail();

$accountId = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
])['id'];
$account = $this->stripe->account()->create([
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accountId = $account['id'];

$token = $this->createBankAccountToken();

Expand All @@ -140,9 +175,16 @@ public function it_can_iterate_all_bank_accounts()
{
$email = $this->getRandomEmail();

$accountId = $this->stripe->account()->create([
'type' => 'custom', 'email' => $email,
])['id'];
$account = $this->stripe->account()->create([
'type' => 'custom',
'email' => $email,
'requested_capabilities' => [
'card_payments',
'transfers',
],
]);

$accountId = $account['id'];

$token = $this->createBankAccountToken();

Expand Down

0 comments on commit 8e480e3

Please sign in to comment.