You are here

public function CommerceProductUIAdminTest::testCommerceProductUIEditProductType in Commerce Core 7

Edit a product type.

File

modules/product/tests/commerce_product_ui.test, line 426
Functional tests for the commerce product ui module.

Class

CommerceProductUIAdminTest
Test the product and product type CRUD.

Code

public function testCommerceProductUIEditProductType() {

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

  // Access to the product types edit form.
  $this
    ->drupalGet('admin/commerce/products/types/product/edit');
  $this
    ->assertResponse(403, t('Normal user is not able to access the product types edit page'));

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

  // Access to the product types edit form.
  $this
    ->drupalGet('admin/commerce/products/types/product/edit');
  $this
    ->assertResponse(200, t('Store admin user can access the product types edit page'));

  // Load all product types.
  $product_types = commerce_product_types();
  $this
    ->assertFieldById('edit-product-type-name', $product_types['product']['name'], t('Product type name appears in the correct field of product type edit form'));
  $this
    ->assertFieldById('edit-product-type-description', $product_types['product']['description'], t('Product type description appears in the correct field of product type edit form'));
}