You are here

public function CommerceCustomerUITest::testCommerceCustomerUIDisableCustomerProfile in Commerce Core 7

Disable a customer profile. @TODO: Probably this test should be completed when it is possible to select older profiles for the orders.

File

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

Class

CommerceCustomerUITest
Functional tests for the commerce customer UI module.

Code

public function testCommerceCustomerUIDisableCustomerProfile() {

  // Create a new customer profile.
  $profile = $this
    ->createDummyCustomerProfile('billing', $this->store_customer->uid);

  // Login with store admin.
  $this
    ->drupalLogin($this->store_admin);

  // Edit the customer profile.
  $this
    ->drupalPost('admin/commerce/customer-profiles/' . $profile->profile_id . '/edit', array(
    'status' => 0,
  ), t('Save profile'));
  $this
    ->drupalGet('admin/commerce/customer-profiles');
  $this
    ->assertText(t('Disabled'), t('\'Disabled\' text for the profile appears in the profile listing page'));
  $profiles = commerce_customer_profile_load_multiple(array(
    $profile->profile_id,
  ), array(), TRUE);
  $profile = reset($profiles);
  $this
    ->assertTrue($profile->status == 0, t('Profile status is Disabled'));
}