You are here

public function AuthcacheUserTest::testSiteContactForm in Authenticated User Page Caching (Authcache) 7.2

Ensure that user setting is embedded for authenticated users.

File

modules/authcache_user/authcache_user.test, line 85
Test cases for the Authcache User module.

Class

AuthcacheUserTest
Tests for markup substitution.

Code

public function testSiteContactForm() {
  $this->stubmod
    ->hook('authcache_p13n_client', array(
    'authcache_p13n_test' => array(
      'title' => t('Test Client'),
      'enabled' => TRUE,
    ),
  ));

  // Ensure that the setting is not added when accessing the site wide contact
  // form with anonymous user.
  $setting_markup = $this
    ->randomName(8);
  $setting_stub = HookStub::on('theme_authcache_p13n_setting__authcache_p13n_test', $setting_markup);
  $this
    ->drupalGet('contact');
  $this
    ->assertNoText($setting_markup);
  $this
    ->assertStub($setting_stub, HookStub::never());

  // Then ensure that the setting is added when the site wide contact form is
  // accessed with authenticated user.
  $this
    ->drupalLogin($this->member1);
  $setting_markup = $this
    ->randomName(8);
  $setting_stub = HookStub::on('theme_authcache_p13n_setting__authcache_p13n_test', $setting_markup);
  $this
    ->drupalGet('contact');
  $this
    ->assertNoText($this->member1->name);
  $this
    ->assertNoText($this->member1->mail);
  $this
    ->assertText($setting_markup);
  $this
    ->assertStub($setting_stub, HookStub::once());
}