public function AuthcacheFieldTest::testAuthcacheFieldFragment in Authenticated User Page Caching (Authcache) 7.2
Ensure that fields are rendered.
Covers AuthcacheFieldFragment
File
- modules/
authcache_field/ authcache_field.test, line 170 - Test cases for the Authcache Field module.
Class
- AuthcacheFieldTest
- Tests for markup substitution.
Code
public function testAuthcacheFieldFragment() {
$request_id = 'asm/field/node/body';
$params = array(
"{$this->node1->nid}:full:en",
"{$this->node2->nid}:full:en",
);
$url = authcache_p13n_request_get_callback($request_id, array(
'field' => $params,
));
$this
->assertTrue($url);
$expected_body_1 = field_view_field('node', $this->node1, 'body', 'full', 'en');
$expected_body_2 = field_view_field('node', $this->node2, 'body', 'full', 'en');
$expect = array(
'field' => array(
"{$this->node1->nid}:full:en" => render($expected_body_1),
"{$this->node2->nid}:full:en" => render($expected_body_2),
),
);
$result = $this
->drupalGetAJAX($GLOBALS['base_root'] . $url['path'], $url['options'], array(
'X-Authcache: 1',
));
$this
->assertResponse(200);
$this
->assertEqual($expect, $result);
}