protected function UcAddressesEntityCase::doEntityWrapperTests in Ubercart Addresses 7
Test if Entity API Wrapper behaves as expected on address entity's.
Parameters
object $entity: The entity to pass to entity API functions.
array $values: The expected values for each field.
Return value
void
1 call to UcAddressesEntityCase::doEntityWrapperTests()
- UcAddressesEntityCase::testEntityCrud in tests/
uc_addresses.entity.test  - Test Ubercart Addresses Entity CRUD.
 
File
- tests/
uc_addresses.entity.test, line 517  - Test cases address entity.
 
Class
- UcAddressesEntityCase
 - Tests for Entity API integration.
 
Code
protected function doEntityWrapperTests($entity, $values) {
  $wrapper = entity_metadata_wrapper('uc_addresses', $entity);
  foreach ($values as $field => $value) {
    switch ($field) {
      case 'uid':
        // The entity property for the 'uid' field is called 'user'.
        $property = 'user';
        break;
      default:
        // All other entity property names are equal to the field name.
        $property = $field;
        break;
    }
    $msgvars = array(
      '@field' => check_plain($field),
    );
    $this
      ->assertEqual($wrapper->{$property}
      ->raw(), $value, strtr('Entity wrapper returns expected value for @field.', $msgvars));
  }
}