/**
* Compares an order-address response with its origin entities.
*
* @param OrderAddressInterface $orderAddress
* @param Address $address
* @param ContactInterface $contact
* @param AccountInterface $account
*/
protected function checkOrderAddress($orderAddress, Address $address, ContactInterface $contact, AccountInterface $account = null)
{
// Contact
$this->assertEquals($contact->getFirstName(), $orderAddress->firstName);
$this->assertEquals($contact->getLastName(), $orderAddress->lastName);
if ($contact->getTitle() !== null) {
$this->assertEquals($contact->getTitle()->getTitle(), $orderAddress->title);
}
// Address
$this->assertEqualsIfExists($address->getStreet(), $orderAddress, 'street');
$this->assertEqualsIfExists($address->getAddition(), $orderAddress, 'addition');
$this->assertEqualsIfExists($address->getNumber(), $orderAddress, 'number');
$this->assertEqualsIfExists($address->getCity(), $orderAddress, 'city');
$this->assertEqualsIfExists($address->getZip(), $orderAddress, 'zip');
$this->assertEqualsIfExists($address->getCountry()->getName(), $orderAddress, 'country');
$this->assertEqualsIfExists($address->getPostboxNumber(), $orderAddress, 'postboxNumber');
$this->assertEqualsIfExists($address->getPostboxCity(), $orderAddress, 'postboxCity');
$this->assertEqualsIfExists($address->getPostboxPostcode(), $orderAddress, 'postboxPostcode');
// Account
if ($account) {
$this->assertEqualsIfExists($account->getName(), $orderAddress, 'accountName');
$this->assertEqualsIfExists($account->getUid(), $orderAddress, 'uid');
}
}