|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace zaporylie\Vipps\Tests\Unit\Model\UserInfo; |
| 4 | + |
| 5 | +use zaporylie\Vipps\Model\Payment\ResponseGetOrderStatus; |
| 6 | +use zaporylie\Vipps\Model\Payment\TransactionInfo; |
| 7 | +use zaporylie\Vipps\Model\UserInfo\Address; |
| 8 | +use zaporylie\Vipps\Model\UserInfo\ResponseUserInfo; |
| 9 | +use zaporylie\Vipps\Resource\Payment\GetOrderStatus; |
| 10 | +use zaporylie\Vipps\Resource\UserInfo\UserInfo; |
| 11 | +use zaporylie\Vipps\Tests\Unit\Model\ModelTestBase; |
| 12 | + |
| 13 | +class ResponseUserInfoTest extends ModelTestBase |
| 14 | +{ |
| 15 | + |
| 16 | + /** |
| 17 | + * @var \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo |
| 18 | + */ |
| 19 | + protected $model; |
| 20 | + |
| 21 | + /** |
| 22 | + * {@inheritdoc} |
| 23 | + */ |
| 24 | + public function setUp() : void |
| 25 | + { |
| 26 | + parent::setUp(); |
| 27 | + $resource = new UserInfo($this->vipps, 'test'); |
| 28 | + $this->model = $resource->getSerializer()->deserialize( |
| 29 | + json_encode((object) [ |
| 30 | + "accounts" => [[ |
| 31 | + "account_name" => "Savings account", |
| 32 | + "account_number" => 86011117947, |
| 33 | + "bank_name" => "ACME Bank" |
| 34 | + ]], |
| 35 | + "address" => [ |
| 36 | + "address_type" => "home", |
| 37 | + "country" => "NO", |
| 38 | + "default" => true, |
| 39 | + "formatted" => "Robert Levins gate 5\n0154 Oslo", |
| 40 | + "postal_code" => "0154", |
| 41 | + "region" => "Oslo", |
| 42 | + "street_address" => "Robert Levins gate 5" |
| 43 | + ], |
| 44 | + "other_addresses" => [[ |
| 45 | + "address_type" => "home", |
| 46 | + "country" => "NO", |
| 47 | + "default" => true, |
| 48 | + "formatted" => "Robert Levins gate 5\n0154 Oslo", |
| 49 | + "postal_code" => "0154", |
| 50 | + "region" => "Oslo", |
| 51 | + "street_address" => "Robert Levins gate 5" |
| 52 | + ]], |
| 53 | + "birthdate" => "2000-12-31", |
| 54 | + |
| 55 | + "email_verified" => true, |
| 56 | + "family_name" => "Lovelace", |
| 57 | + "given_name" => "Ada", |
| 58 | + "name" => "Ada Lovelace", |
| 59 | + "nin" => "09057517287", |
| 60 | + "phone_number" => "47912345678", |
| 61 | + "sid" => "7d78a726-af92-499e-b857-de263ef9a969", |
| 62 | + "sub" => "c06c4afe-d9e1-4c5d-939a-177d752a0944" |
| 63 | + ]), |
| 64 | + ResponseUserInfo::class, |
| 65 | + 'json' |
| 66 | + ); |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getAccounts |
| 71 | + */ |
| 72 | + public function testGetAccounts() |
| 73 | + { |
| 74 | + $this->assertIsArray($this->model->getAccounts()); |
| 75 | + $this->assertNotEmpty($this->model->getAccounts()); |
| 76 | + } |
| 77 | + |
| 78 | + /** |
| 79 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getAddress |
| 80 | + */ |
| 81 | + public function testGetAddress() |
| 82 | + { |
| 83 | + $this->assertInstanceOf(Address::class, $this->model->getAddress()); |
| 84 | + } |
| 85 | + |
| 86 | + /** |
| 87 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getBirthdate |
| 88 | + */ |
| 89 | + public function testGetBirthday() |
| 90 | + { |
| 91 | + $this->assertEquals('2000-12-31', $this->model->getBirthdate()); |
| 92 | + } |
| 93 | + |
| 94 | + /** |
| 95 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getEmail |
| 96 | + */ |
| 97 | + public function testGetEmail() |
| 98 | + { |
| 99 | + $this-> assertEquals( '[email protected]', $this-> model-> getEmail()); |
| 100 | + } |
| 101 | + |
| 102 | + /** |
| 103 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getFamilyName |
| 104 | + */ |
| 105 | + public function testGetFamilyName() |
| 106 | + { |
| 107 | + $this->assertEquals('Lovelace', $this->model->getFamilyName()); |
| 108 | + } |
| 109 | + |
| 110 | + /** |
| 111 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getGivenName |
| 112 | + */ |
| 113 | + public function testGetGivenName() |
| 114 | + { |
| 115 | + $this->assertEquals('Ada', $this->model->getGivenName()); |
| 116 | + } |
| 117 | + |
| 118 | + /** |
| 119 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getName |
| 120 | + */ |
| 121 | + public function testGetName() |
| 122 | + { |
| 123 | + $this->assertEquals('Ada Lovelace', $this->model->getName()); |
| 124 | + } |
| 125 | + |
| 126 | + /** |
| 127 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getNin |
| 128 | + */ |
| 129 | + public function testGetNin() |
| 130 | + { |
| 131 | + $this->assertEquals('09057517287', $this->model->getNin()); |
| 132 | + } |
| 133 | + |
| 134 | + /** |
| 135 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getPhoneNumber |
| 136 | + */ |
| 137 | + public function testGetPhoneNumber() |
| 138 | + { |
| 139 | + $this->assertEquals('47912345678', $this->model->getPhoneNumber()); |
| 140 | + } |
| 141 | + |
| 142 | + /** |
| 143 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getSid |
| 144 | + */ |
| 145 | + public function testGetSid() |
| 146 | + { |
| 147 | + $this->assertEquals('7d78a726-af92-499e-b857-de263ef9a969', $this->model->getSid()); |
| 148 | + } |
| 149 | + |
| 150 | + /** |
| 151 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getSub |
| 152 | + */ |
| 153 | + public function testGetSub() |
| 154 | + { |
| 155 | + $this->assertEquals('c06c4afe-d9e1-4c5d-939a-177d752a0944', $this->model->getSub()); |
| 156 | + } |
| 157 | + |
| 158 | + /** |
| 159 | + * @covers \zaporylie\Vipps\Model\UserInfo\ResponseUserInfo::getOtherAddresses |
| 160 | + */ |
| 161 | + public function testGetOtherAddresses() |
| 162 | + { |
| 163 | + $this->assertIsArray($this->model->getOtherAddresses()); |
| 164 | + $this->assertNotEmpty($this->model->getOtherAddresses()); |
| 165 | + } |
| 166 | +} |
0 commit comments