public function AuthcacheP13nTestMarkup::testFallbackCancel in Authenticated User Page Caching (Authcache) 7.2
Cover authcache_p13n_authcache_p13n_client_fallback_alter().
File
- modules/
authcache_p13n/ tests/ authcache_p13n.markup.test, line 191 - Define tests for markup substitution.
Class
- AuthcacheP13nTestMarkup
- Tests for markup substitution.
Code
public function testFallbackCancel() {
$this
->createRequestHandlers();
$canceled = authcache_canceled();
$this
->assertEqual(FALSE, $canceled);
$expect = '<!-- Error: Failed to render fragment -->';
$result = theme('authcache_p13n_fragment', array(
'fragment' => 'a-frag',
'fallback' => 'hide',
));
$this
->assertEqual($expect, $result, t('Default markup when fragment is not renderable'));
$canceled = authcache_canceled();
$this
->assertEqual(FALSE, $canceled);
$expect = '<!-- Error: Failed to render fragment -->';
$result = theme('authcache_p13n_fragment', array(
'fragment' => 'a-frag',
'fallback' => 'cancel',
));
$this
->assertEqual($expect, $result, t('Default markup when fragment is not renderable'));
$canceled = authcache_canceled();
$this
->assertEqual(TRUE, $canceled);
$this
->resetAll();
$canceled = authcache_canceled();
$this
->assertEqual(FALSE, $canceled);
$orig = '<span>original content</span>';
$result = theme('authcache_p13n_fragment', array(
'fragment' => 'a-frag',
'fallback' => 'cancel',
'original' => $orig,
));
$this
->assertEqual($orig, $result, t('Original markup when fragment is not renderable'));
$canceled = authcache_canceled();
$this
->assertEqual(TRUE, $canceled);
}