You are here

public function CommerceCustomerUITest::testCommerceCustomerUIAccessCustomerProfilesListing in Commerce Core 7

Access to the customer profiles listing.

File

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

Class

CommerceCustomerUITest
Functional tests for the commerce customer UI module.

Code

public function testCommerceCustomerUIAccessCustomerProfilesListing() {

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

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

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

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

  // Check the message of no profiles available.
  $this
    ->assertText(t('No customer profiles have been created yet.'), t('\'No customer profiles have been created yet\' message is displayed'));

  // Check the add customer profile link.
  $this
    ->assertRaw(l('Add a customer profile', 'admin/commerce/customer-profiles/add'), t('\'Add a customer profile\' link is present in the page'));
}