You are here

public function ClassifiedTestTestBasicTest::test1382234 in Classified Ads 7.3

Issue #1382234: Create new ad link missing.

Root cause: improper caching.

File

tests/classified_test_basic.test, line 343

Class

ClassifiedTestTestBasicTest
Basic test for known bugs in previous versions.

Code

public function test1382234() {
  $this->group = __FUNCTION__;
  $accounts = array(
    'creator',
  );
  $this
    ->createUsers($accounts);
  $this
    ->drupalLogin($this->creatorUser);

  // Force caching of overview page.
  cache_clear_all('classified:overview', 'cache');
  $this
    ->drupalGet('classified');
  $this
    ->assertLink(t('Add one'), 0, t('Creator sees ad creation link.'));

  // Anon. should not get creation link from page cached for auth. users.
  $this
    ->drupalLogout();
  $this
    ->drupalGet('classified');
  $this
    ->assertNoLink(t('Add one'), t('Anonymous users do not see ad creation link.'));
  cache_clear_all('classified:overview', 'cache');
  $this
    ->drupalGet('classified');
  $this
    ->assertNoLink(t('Add one'), t('Anonymous users do not see ad creation link.'));

  // Creator user should see the Add one link on the cached page.
  $this
    ->drupalLogin($this->creatorUser);
  $this
    ->drupalGet('classified');
  $this
    ->assertLink(t('Add one'), 0, t('Creator sees ad creation link.'));
}