35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Tests\Entity;
|
||
|
|
|
||
|
|
use App\Entity\Customer;
|
||
|
|
use App\Entity\CustomerAddress;
|
||
|
|
use PHPUnit\Framework\TestCase;
|
||
|
|
|
||
|
|
class CustomerAddressTest extends TestCase
|
||
|
|
{
|
||
|
|
public function testGettersAndSetters()
|
||
|
|
{
|
||
|
|
$address = new CustomerAddress();
|
||
|
|
$customer = new Customer();
|
||
|
|
|
||
|
|
$address->setCustomer($customer);
|
||
|
|
$address->setAddress('123 Test St');
|
||
|
|
$address->setAddress2('Apt 1');
|
||
|
|
$address->setAddress3('Building A'); // address3 is nullable:true, but setter expects string
|
||
|
|
$address->setZipcode('12345');
|
||
|
|
$address->setCity('Test City');
|
||
|
|
$address->setCountry('Test Country');
|
||
|
|
$address->setComment('Some comment');
|
||
|
|
|
||
|
|
$this->assertSame($customer, $address->getCustomer());
|
||
|
|
$this->assertEquals('123 Test St', $address->getAddress());
|
||
|
|
$this->assertEquals('Apt 1', $address->getAddress2());
|
||
|
|
$this->assertEquals('Building A', $address->getAddress3());
|
||
|
|
$this->assertEquals('12345', $address->getZipcode());
|
||
|
|
$this->assertEquals('Test City', $address->getCity());
|
||
|
|
$this->assertEquals('Test Country', $address->getCountry());
|
||
|
|
$this->assertEquals('Some comment', $address->getComment());
|
||
|
|
}
|
||
|
|
}
|