-
Notifications
You must be signed in to change notification settings - Fork 12
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
Showing
2 changed files
with
49 additions
and
13 deletions.
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
use League\OAuth2\Client\Token\AccessToken; | ||
use Mockery as m; | ||
use Mollie\OAuth2\Client\Provider\Mollie; | ||
use Mollie\OAuth2\Client\Provider\MollieResourceOwner; | ||
use Psr\Http\Message\ResponseInterface; | ||
|
||
class MollieTest extends \PHPUnit_Framework_TestCase | ||
|
@@ -186,21 +187,26 @@ public function testUserData() | |
$accountResponse->shouldReceive('getBody')->andReturn( | ||
'{ | ||
"resource": "organization", | ||
"id": "org_162634", | ||
"name": "Kicks To The Face B.V.", | ||
"id": "org_12345678", | ||
"name": "Mollie B.V.", | ||
"email": "[email protected]", | ||
"address": { | ||
"streetAndNumber": "Keizersgracht 313", | ||
"postalCode": "1016 EE", | ||
"streetAndNumber": "Keizersgracht 126", | ||
"postalCode": "1015 CW", | ||
"city": "Amsterdam", | ||
"country": "NL" | ||
}, | ||
"registrationNumber": "370355724", | ||
"registrationNumber": "30204462", | ||
"vatNumber": "NL815839091B01" | ||
"_links": { | ||
"self": { | ||
"href": "https://api.mollie.com/v2/organizations/me", | ||
"href": "https://api.mollie.com/v2/organizations/org_12345678", | ||
"type": "application/hal+json" | ||
}, | ||
"dashboard": { | ||
"href": "https://mollie.com/dashboard/org_12345678", | ||
"type": "text/html" | ||
}, | ||
"chargebacks": { | ||
"href": "https://api.mollie.com/v2/chargebacks", | ||
"type": "application/hal+json" | ||
|
@@ -248,22 +254,28 @@ public function testUserData() | |
$token = $this->provider->getAccessToken('authorization_code', ['code' => 'mock_authorization_code']); | ||
$account = $this->provider->getResourceOwner($token); | ||
|
||
assert($account instanceof MollieResourceOwner); | ||
|
||
$array = $account->toArray(); | ||
|
||
$this->assertEquals('org_162634', $account->getId()); | ||
$this->assertEquals('org_162634', $array['id']); | ||
$this->assertEquals('Kicks To The Face B.V.', $array['name']); | ||
$this->assertEquals('org_12345678', $account->getId()); | ||
$this->assertEquals('org_12345678', $array['id']); | ||
$this->assertEquals('Mollie B.V.', $array['name']); | ||
$this->assertEquals('[email protected]', $array['email']); | ||
$this->assertEquals('[email protected]', $account->getEmail()); | ||
$this->assertEquals( | ||
[ | ||
"streetAndNumber" => "Keizersgracht 313", | ||
"postalCode" => "1016 EE", | ||
"streetAndNumber" => "Keizersgracht 126", | ||
"postalCode" => "1015 CW", | ||
"city" => "Amsterdam", | ||
"country" => "NL", | ||
], | ||
$array['address'] | ||
); | ||
$this->assertEquals('370355724', $array['registrationNumber']); | ||
$this->assertEquals('30204462', $array['registrationNumber']); | ||
$this->assertEquals('30204462', $account->getRegistrationNumber()); | ||
$this->assertEquals('NL815839091B01', $array['vatNumber']); | ||
$this->assertEquals('NL815839091B01', $account->getVatNumber()); | ||
} | ||
|
||
public function testWhenDefiningADifferentMollieApiUrlThenUseThisOnApiCalls() | ||
|