You are here

public function CommerceCustomerUITest::testCommerceCustomerUIAccessCustomerProfileTypesListing in Commerce Core 7

Access to the customer profile types listing.

File

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

Class

CommerceCustomerUITest
Functional tests for the commerce customer UI module.

Code

public function testCommerceCustomerUIAccessCustomerProfileTypesListing() {

  // Login with customer.
  $this
    ->drupalLogin($this->store_customer);

  // Check the access to the profile types listing.
  $this
    ->drupalGet('admin/commerce/customer-profiles/types');
  $this
    ->assertResponse(403, t('The store customer has no access to the administration listing of customer profile types'));

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

  // Check the access to the profile types listing.
  $this
    ->drupalGet('admin/commerce/customer-profiles/types');
  $this
    ->assertResponse(200, t('The store customer has access to the administration listing of customer profile types'));

  // Check if all the profiles defined by default are there.
  $types = commerce_customer_profile_types();
  foreach ($types as $type) {
    $this
      ->assertText($type['name'], t('!type customer profile type is found in the listing', array(
      '!type' => $type['name'],
    )));
  }
}