You are here

public function CommerceOrderUIAdminTest::testCommerceOrderAdminUIDisplayFields in Commerce Core 7

Test the integrity of display fields Order UI form pages.

File

modules/order/tests/commerce_order_ui.test, line 424
Functional tests for the commerce order UI module.

Class

CommerceOrderUIAdminTest
Functional tests for the commerce order UI module.

Code

public function testCommerceOrderAdminUIDisplayFields() {

  // Log in as a normal user.
  $this
    ->drupalLogin($this->store_customer);

  // Navigate to the display fields screen for the order type.
  $this
    ->drupalGet('admin/commerce/config/order/display');
  $this
    ->assertResponse(403, t('Normal user is not able to access the display fields screen for the order type'));

  // Log in as store admin.
  $this
    ->drupalLogin($this->store_admin);

  // Navigate to the display fields screen for the order type.
  $this
    ->drupalGet('admin/commerce/config/order/display');
  $this
    ->assertResponse(200, t('Store admin user can access the display fields screen for the order type'));

  // Assert the field instances for the display.
  $field_instances = field_info_instances('commerce_order', 'commerce_order');
  foreach ($field_instances as $instance) {
    $this
      ->assertText($instance['label'], t('%instance is present in the display fields screen', array(
      '%instance' => $instance['label'],
    )));
  }
}