You are here

public function AuthcacheP13nTestMarkup::testCustomClientMarkup in Authenticated User Page Caching (Authcache) 7.2

Cover theme_authcache_p13n_X().

File

modules/authcache_p13n/tests/authcache_p13n.markup.test, line 231
Define tests for markup substitution.

Class

AuthcacheP13nTestMarkup
Tests for markup substitution.

Code

public function testCustomClientMarkup() {
  $this
    ->createRequestHandlers();
  $client_info = array(
    'authcache_p13n_test' => array(
      'name' => t('Test Client'),
      'enabled' => TRUE,
    ),
  );
  $client_info_stub = $this->stubmod
    ->hook('authcache_p13n_client', $client_info);
  $client_info_alter_stub = $this->stubmod
    ->hook('authcache_p13n_client_alter');
  $fragment_stub = HookStub::on('theme_authcache_p13n_fragment__authcache_p13n_test', '<!-- test fragment -->');
  $setting_stub = HookStub::on('theme_authcache_p13n_setting__authcache_p13n_test', '<!-- test setting -->');
  $assembly_stub = HookStub::on('theme_authcache_p13n_assembly__authcache_p13n_test', '<!-- test assembly -->');
  $partial_stub = HookStub::on('theme_authcache_p13n_partial__authcache_p13n_test', '<!-- test partial -->');
  $expect = '<!-- test fragment -->';
  $result = theme('authcache_p13n_fragment', array(
    'fragment' => 'a-frag',
  ));
  $this
    ->assertEqual($expect, $result, t('Custom markup for fragment'));
  $expect = '<!-- test setting -->';
  $result = theme('authcache_p13n_setting', array(
    'setting' => 'a-setting',
  ));
  $this
    ->assertEqual($expect, $result, t('Custom markup for setting'));
  $expect = '<!-- test assembly -->';
  $result = theme('authcache_p13n_assembly', array(
    'assembly' => 'an-assembly',
  ));
  $this
    ->assertEqual($expect, $result, t('Custom markup for assembly'));
  $expect = '<!-- test partial -->';
  $result = theme('authcache_p13n_partial', array(
    'assembly' => 'an-assembly',
    'partial' => 'a-partial',
  ));
  $this
    ->assertEqual($expect, $result, t('Custom markup for partial'));
  $this
    ->assertStub($fragment_stub, HookStub::once());
  $this
    ->assertStub($setting_stub, HookStub::once());
  $this
    ->assertStub($assembly_stub, HookStub::once());
  $this
    ->assertStub($partial_stub, HookStub::once());
  $this
    ->assertStub($client_info_stub, HookStub::once());
  $expect_args = array(
    $client_info,
    NULL,
    NULL,
    NULL,
  );
  $this
    ->assertStub($client_info_alter_stub, HookStub::args($expect_args));
}