public function CommerceDiscountUITest::testCommerceDiscountUIAccessDiscountsListing in Commerce Discount 7
Access to commerce discounts admin.
File
- tests/
commerce_discount_ui.test, line 39 - Commerce Discounts UI tests.
Class
- CommerceDiscountUITest
- Testing commerce discounts UI.
Code
public function testCommerceDiscountUIAccessDiscountsListing() {
// Login with customer.
$this
->drupalLogin($this->store_customer);
// Check the access to the profiles listing.
$this
->drupalGet('admin/commerce/discounts');
$this
->assertResponse(403, 'The store customer has no access to discounts administration.');
// Login with store admin.
$this
->drupalLogin($this->store_admin);
// Check the access to the profiles listing.
$this
->drupalGet('admin/commerce/discounts');
$this
->assertResponse(200, 'The store admin has access to discounts administration.');
// Check the message of no discounts available.
$this
->assertText(t('No discounts found.'), "'No discounts found.' message is displayed");
// Check the add customer profile link.
$this
->assertRaw(l(t('Add discount'), 'admin/commerce/discounts/add'), "'Add discount' link is present in the page");
}