You are here

public function UcAddressesEntityCase::testUcAddressesPropertySet in Ubercart Addresses 7

Tests setting uc_addresses property on an address.

@covers uc_addresses_field_set()

File

tests/uc_addresses.entity.test, line 252
Test cases address entity.

Class

UcAddressesEntityCase
Tests for Entity API integration.

Code

public function testUcAddressesPropertySet() {
  $city = self::randomName();

  // Create a new address.
  $address = UcAddressesAddressBook::newAddress();

  // Set a property using the Entity API's metadata wrapper.
  $address_wrapper = entity_metadata_wrapper('uc_addresses', $address);
  $address_wrapper->city
    ->set($city);

  // Assert that the property was set.
  $this
    ->assertEqual($city, $address
    ->getField('city'));
}