You are here

protected function CommerceCustomerUITest::loadCustomerProfile in Commerce Core 7

Load a customer profile basing in field conditions.

4 calls to CommerceCustomerUITest::loadCustomerProfile()
CommerceCustomerUITest::testCommerceCustomerUIAddCustomerProfile in modules/customer/tests/commerce_customer_ui.test
Add a customer profile.
CommerceCustomerUITest::testCommerceCustomerUIAddCustomerProfileSaveAndAddAnother in modules/customer/tests/commerce_customer_ui.test
Save and add another customer profile.
CommerceCustomerUITest::testCommerceCustomerUIAddProfileViaOrderUI in modules/customer/tests/commerce_customer_ui.test
Add a customer profile using the Order interface.
CommerceCustomerUITest::testCommerceCustomerUIProfileWithExtraFields in modules/customer/tests/commerce_customer_ui.test
Add extra fields to a profile type.

File

modules/customer/tests/commerce_customer_ui.test, line 41
Commerce customer profile tests.

Class

CommerceCustomerUITest
Functional tests for the commerce customer UI module.

Code

protected function loadCustomerProfile($conditions) {
  $query = db_select('commerce_customer_profile', 'cp');
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'commerce_customer_profile', '=');
  foreach ($conditions as $condition) {
    $operation = !empty($condition['operation']) ? $condition['operation'] : '=';
    $query
      ->fieldCondition($condition['field'], $condition['column'], $condition['value'], $operation);
  }
  $results = $query
    ->execute();
  return $results['commerce_customer_profile'];
}