You are here

public function UcAddressesApiTestCase::testAddressOutput in Ubercart Addresses 7

Tests if address objects can be converted to a string.

File

tests/uc_addresses.api.test, line 211
Test cases for the api component.

Class

UcAddressesApiTestCase
Test cases for the api component.

Code

public function testAddressOutput() {
  $addressBook = $this
    ->UcAddressesGetAddressBook($this->adminUser->uid);

  // Add three addresses.
  for ($i = 0; $i < 3; $i++) {
    $address = $addressBook
      ->addAddress();
    $values = self::getEditAddressValues();
    $address
      ->setMultipleFields($values['values'], TRUE);
  }
  $addresses = $addressBook
    ->getAddresses();
  $address1 = reset($addresses);
  $this
    ->verbose(theme('uc_addresses_list_address', array(
    'address' => $address1,
  )));
  $this
    ->verbose($address1
    ->__toString());
  $output = (string) $addressBook;
  $this
    ->verbose($output);

  // Test if all addresses are displayed.
  foreach ($addresses as $address) {
    $this
      ->doAddressValuesDisplayedTests($address
      ->getRawFieldData(), 'address_view', $output);
  }
}