public function CommerceProductUIAdminTest::testCommerceProductUIAccessProductList in Commerce Core 7
Test the permissions to access the product listing.
File
- modules/
product/ tests/ commerce_product_ui.test, line 54 - Functional tests for the commerce product ui module.
Class
- CommerceProductUIAdminTest
- Test the product and product type CRUD.
Code
public function testCommerceProductUIAccessProductList() {
// Login with normal user.
$this
->drupalLogin($this->store_customer);
// Access to the admin product list.
$this
->drupalGet('admin/commerce/products');
$this
->assertResponse(403, t('Normal user is not able to access the product admin list page'));
// Login with store admin.
$this
->drupalLogin($this->store_admin);
// Access to the admin product list.
$this
->drupalGet('admin/commerce/products');
$this
->assertResponse(200, t('Store admin user can access the product admin list page'));
// Ensure that the link for create products is in place.
$this
->assertText(t('Add a product'), t('%addproduct link is present in the admin list page', array(
'%addproduct' => t('Add a product'),
)));
}