public function AuthcacheP13nTestMarkup::testRenderElement in Authenticated User Page Caching (Authcache) 7.2
Cover authcache_p13n_attach().
File
- modules/
authcache_p13n/ tests/ authcache_p13n.markup.test, line 276 - Define tests for markup substitution.
Class
- AuthcacheP13nTestMarkup
- Tests for markup substitution.
Code
public function testRenderElement() {
$this
->createRequestHandlers();
$element = array(
'#markup' => 'original personalized content',
);
authcache_p13n_attach($element, array(
'#theme' => 'authcache_p13n_fragment',
'#fragment' => 'a-frag',
));
$expect = '<!-- Error: Failed to render fragment -->';
$result = render($element);
$this
->assertEqual($expect, $result, t('Default markup when fragment is not renderable'));
// Do not replace element when page caching was canceled.
$element = array(
'#markup' => 'original personalized content',
);
authcache_p13n_attach($element, array(
'#theme' => 'authcache_p13n_fragment',
'#fragment' => 'a-frag',
));
authcache_cancel(t('some reason'));
$expect = 'original personalized content';
$result = render($element);
$this
->assertEqual($expect, $result, t('Original markup when page caching was cancelled'));
}