mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
85 lines
2.3 KiB
PHP
85 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 7.2
|
|
*
|
|
* @package tests
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link http://website.orange-management.de
|
|
*/
|
|
|
|
namespace phpOMS\tests\Stdlib\Base;
|
|
|
|
use phpOMS\Stdlib\Base\Address;
|
|
use phpOMS\Stdlib\Base\Location;
|
|
|
|
class AddressTest extends \PHPUnit\Framework\TestCase
|
|
{
|
|
public function testAttributes()
|
|
{
|
|
$address = new Address();
|
|
self::assertObjectHasAttribute('recipient', $address);
|
|
self::assertObjectHasAttribute('fao', $address);
|
|
self::assertObjectHasAttribute('location', $address);
|
|
}
|
|
|
|
public function testDefault()
|
|
{
|
|
$expected = [
|
|
'recipient' => '',
|
|
'fao' => '',
|
|
'location' => [
|
|
'postal' => '',
|
|
'city' => '',
|
|
'country' => '',
|
|
'address' => '',
|
|
'state' => '',
|
|
'geo' => [
|
|
'lat' => 0,
|
|
'long' => 0
|
|
],
|
|
]
|
|
];
|
|
|
|
$address = new Address();
|
|
self::assertEquals('', $address->getRecipient());
|
|
self::assertEquals('', $address->getFAO());
|
|
self::assertInstanceOf('\phpOMS\Stdlib\Base\Location', $address->getLocation());
|
|
self::assertEquals($expected, $address->toArray());
|
|
self::assertEquals($expected, $address->jsonSerialize());
|
|
}
|
|
|
|
public function testGetSet()
|
|
{
|
|
$expected = [
|
|
'recipient' => 'recipient',
|
|
'fao' => 'fao',
|
|
'location' => [
|
|
'postal' => '',
|
|
'city' => '',
|
|
'country' => '',
|
|
'address' => '',
|
|
'state' => '',
|
|
'geo' => [
|
|
'lat' => 0,
|
|
'long' => 0
|
|
],
|
|
]
|
|
];
|
|
|
|
$address = new Address();
|
|
$address->setFAO('fao');
|
|
$address->setRecipient('recipient');
|
|
$address->setLocation(new Location());
|
|
|
|
self::assertEquals('recipient', $address->getRecipient());
|
|
self::assertEquals('fao', $address->getFAO());
|
|
self::assertInstanceOf('\phpOMS\Stdlib\Base\Location', $address->getLocation());
|
|
self::assertEquals($expected, $address->toArray());
|
|
self::assertEquals($expected, $address->jsonSerialize());
|
|
}
|
|
}
|