You are here

public function CommerceOrderUIAdminTest::testCommerceOrderAdminUIManageFields in Commerce Core 7

Test the integrity of manage fields Order UI form pages.

File

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

Class

CommerceOrderUIAdminTest
Functional tests for the commerce order UI module.

Code

public function testCommerceOrderAdminUIManageFields() {

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

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

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

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

  // Get the instances attached to the commerce order bundle and assert if
  // they are present in the form.
  $field_instances = field_info_instances('commerce_order', 'commerce_order');
  foreach ($field_instances as $instance) {
    $this
      ->assertText($instance['label'], t('%instance is present in the manage fields screen', array(
      '%instance' => $instance['label'],
    )));
  }
}