You are here

public function CommerceReportsUITestCase::testMenuIntegration in Commerce Reporting 7.3

File

tests/commerce_reports.test, line 159
Unit tests for the commerce reports module.

Class

CommerceReportsUITestCase

Code

public function testMenuIntegration() {
  $admin = $this
    ->createUserWithPermissionHelper(array(
    'site admin',
    'store admin',
  ));
  $this
    ->drupalLogin($admin);
  $this
    ->drupalGet('admin');
  $links = $this
    ->_getLinks(t('Reports'));
  $this
    ->assertEqual(count($links), 1, t("The correct amount of menu entries to 'Reports' was found on the administration page."));
  if ($links) {
    $attributes = reset($links)
      ->attributes();
    $this
      ->assertEqual($attributes['href'], '/?q=admin/reports', t('The menu entry points to the correct page.'));
  }
  $this
    ->drupalGet('admin/commerce');
  $links = $this
    ->_getLinks(t('Reports'));
  $this
    ->assertEqual(count($links), 1, t("The correct amount of menu entries to 'Reports' was found on the store administration page."));
  if ($links) {
    $attributes = reset($links)
      ->attributes();
    $this
      ->assertEqual($attributes['href'], '/?q=admin/commerce/reports', t('The menu entry points to the correct page.'));
  }
  $this
    ->drupalGet('admin/commerce/reports');
  $this
    ->assertResponse(200, t('Reports admin can access reports.'));
}