public function CommerceTaxUIAdminTest::testCommerceTaxUIAccessTaxTypes in Commerce Core 7
Test access to tax types listing.
File
- modules/
tax/ tests/ commerce_tax_ui.test, line 322 - Functional tests for the commerce tax UI module.
Class
- CommerceTaxUIAdminTest
- Functional tests for the commerce tax UI module.
Code
public function testCommerceTaxUIAccessTaxTypes() {
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Access the tax rate types listing.
$this
->drupalGet('admin/commerce/config/taxes/types');
// It should return a 403.
$this
->assertResponse(403, t('Normal user is not able to access the tax types listing'));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the tax rate types listing.
$this
->drupalGet('admin/commerce/config/taxes/types');
// It should return a 200.
$this
->assertResponse(200, t('Store admin user can access the tax types listing'));
// Load the tax rate types and check that all of them are in the page.
$tax_types = commerce_tax_types();
foreach ($tax_types as $tax_type) {
$this
->assertText($tax_type['display_title'], t('Tax type !name is present in the tax types listing page', array(
'!name' => $tax_type['display_title'],
)));
}
// Look for the Add tax type link.
$this
->assertText(t('Add a tax type'), t('%link link is present in the tax rates listing page', array(
'%link' => t('Add a tax type'),
)));
}