You are here

function ClassifiedBasicTest::test0547214 in Classified Ads 6.3

Bug 547214: view Ads tab for users without permission.

File

tests/classified_basic.test, line 140
Basic test for known bugs in previous versions.

Class

ClassifiedBasicTest

Code

function test0547214() {
  $this->group = __FUNCTION__;
  $accounts = array(
    'admin',
    'basic',
    'creator',
  );
  $this
    ->createUsers($accounts);
  foreach ($accounts as $account_name) {
    $account = $this->{$account_name . 'User'};
    $this
      ->drupalLogin($account);
    $this
      ->assertLink(t('Ads'), 0, t('User %name (@uid) sees "Ads" tab on his own account page', array(
      '%name' => $account_name,
      '@uid' => $this->{$account_name . 'User'}->uid,
    )), 'Ads Tab');
    $this
      ->drupalGet('user/' . $this->adminUser->uid);
    if ($account_name == 'creator') {
      $this
        ->assertLink(t('Ads'), 0, t('User %name sees "Ads" tab on other account pages', array(
        '%name' => $account_name,
      )), 'Ads Tab');
    }
    elseif ($account_name == 'basic') {
      $this
        ->assertNoLink(t('Ads'), t('User %name does not see "Ads" tab on other account pages', array(
        '%name' => $account_name,
      )), 'Ads Tab');
    }

    // No else: admin seeing admin has already been tested.
    $this
      ->drupalLogout();
  }
}