function EntityFieldBlockTest::testRenderCache
Same name in other branches
- 8.x-3.x modules/ctools_block/tests/src/Functional/EntityFieldBlockTest.php \Drupal\Tests\ctools_block\Functional\EntityFieldBlockTest::testRenderCache()
Tests that we are setting the render cache metadata correctly.
File
-
modules/
ctools_block/ tests/ src/ Functional/ EntityFieldBlockTest.php, line 113
Class
- EntityFieldBlockTest
- Tests the entity field block.
Namespace
Drupal\Tests\ctools_block\FunctionalCode
public function testRenderCache() {
$this->drupalPlaceBlock('entity_field:node:body', [
'formatter' => [
'type' => 'text_default',
],
'context_mapping' => [
'entity' => '@node.node_route_context:node',
],
]);
$a = $this->drupalCreateNode([
'type' => 'ctools_block_field_test',
]);
$b = $this->drupalCreateNode([
'type' => 'ctools_block_field_test',
]);
$assert = $this->assertSession();
$this->drupalGet('node/' . $a->id());
$assert->pageTextContains($a->body->value);
$this->drupalGet('node/' . $b->id());
$assert->pageTextNotContains($a->body->value);
$assert->pageTextContains($b->body->value);
$text = 'This is my text. Are you not entertained?';
$a->body->value = $text;
$a->save();
$this->drupalGet('node/' . $a->id());
$assert->pageTextContains($text);
}