You are here

public function CommerceTaxUIAdminTest::testCommerceTaxUIAccessTaxRates in Commerce Core 7

Test access to tax rates listing.

File

modules/tax/tests/commerce_tax_ui.test, line 80
Functional tests for the commerce tax UI module.

Class

CommerceTaxUIAdminTest
Functional tests for the commerce tax UI module.

Code

public function testCommerceTaxUIAccessTaxRates() {

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

  // Access the Tax rates listing.
  $this
    ->drupalGet('admin/commerce/config/taxes');

  // It should return a 403.
  $this
    ->assertResponse(403, t('Normal user is not able to access the tax rates listing page'));

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

  // Access the Tax rates listing.
  $this
    ->drupalGet('admin/commerce/config/taxes');

  // It should return a 200.
  $this
    ->assertResponse(200, t('Store admin user can access the tax rates listing page'));

  // Check if the add link is there.
  $this
    ->assertText(t('Add a tax rate'), t('%link link is present in the tax rates listing page', array(
    '%link' => t('Add a tax rate'),
  )));

  // There shouldn't be any tax rate yet.
  $this
    ->assertRaw(t('There are no tax rates yet. <a href="@link">Add a tax rate</a>.', array(
    '@link' => url('admin/commerce/config/taxes/rates/add'),
  )), t('Empty tax rate listing message is displayed'));
}