woocommerce-paypal-payments/tests/PHPUnit/ApiClient/Entity/AddressTest.php

54 lines
1.4 KiB
PHP
Raw Normal View History

2020-08-31 13:38:54 +03:00
<?php
declare(strict_types=1);
2020-09-14 07:51:45 +03:00
namespace WooCommerce\PayPalCommerce\ApiClient\Entity;
2020-08-31 13:38:54 +03:00
2022-02-09 16:28:27 +02:00
use WooCommerce\PayPalCommerce\TestCase;
2020-08-31 13:38:54 +03:00
class AddressTest extends TestCase
{
public function test()
{
$testee = new Address(
'countryCode',
'addressLine1',
'addressLine2',
'adminArea1',
'adminArea2',
'postalCode'
);
2020-09-01 09:47:36 +03:00
$this->assertEquals('countryCode', $testee->country_code());
$this->assertEquals('addressLine1', $testee->address_line_1());
$this->assertEquals('addressLine2', $testee->address_line_2());
$this->assertEquals('adminArea1', $testee->admin_area_1());
$this->assertEquals('adminArea2', $testee->admin_area_2());
$this->assertEquals('postalCode', $testee->postal_code());
2020-08-31 13:38:54 +03:00
}
public function testToArray()
{
$testee = new Address(
'countryCode',
'addressLine1',
'addressLine2',
'adminArea1',
'adminArea2',
'postalCode'
);
$expected = [
'country_code' => 'countryCode',
'address_line_1' => 'addressLine1',
'address_line_2' => 'addressLine2',
'admin_area_1' => 'adminArea1',
'admin_area_2' => 'adminArea2',
'postal_code' => 'postalCode',
];
2020-09-01 09:47:36 +03:00
$actual = $testee->to_array();
2020-08-31 13:38:54 +03:00
$this->assertEquals($expected, $actual);
}
}