You are here

public function ClassifiedTestTestBasicTest::test0547214 in Classified Ads 7.3

Bug 547214: view Ads tab for users without permission.

File

tests/classified_test_basic.test, line 142

Class

ClassifiedTestTestBasicTest
Basic test for known bugs in previous versions.

Code

public function test0547214() {
  $this->group = __FUNCTION__;
  $accounts = array(
    'admin',
    'basic',
    'creator',
  );
  $this
    ->createUsers($accounts);
  foreach ($accounts as $account_name) {
    $this
      ->drupalLogin($this->{$account_name . 'User'});
    $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();
  }
}