function EntityFieldBlockTest::testNodeBaseFields
Same name in other branches
- 8.x-3.x modules/ctools_block/tests/src/Functional/EntityFieldBlockTest.php \Drupal\Tests\ctools_block\Functional\EntityFieldBlockTest::testNodeBaseFields()
Tests using the node uid base field in a block.
File
-
modules/
ctools_block/ tests/ src/ Functional/ EntityFieldBlockTest.php, line 94
Class
- EntityFieldBlockTest
- Tests the entity field block.
Namespace
Drupal\Tests\ctools_block\FunctionalCode
public function testNodeBaseFields() {
$block = $this->drupalPlaceBlock('entity_field:node:title', [
'formatter' => [
'type' => 'string',
],
'context_mapping' => [
'entity' => '@node.node_route_context:node',
],
]);
$node = $this->drupalCreateNode([
'type' => 'ctools_block_field_test',
'uid' => 1,
]);
$this->drupalGet('node/' . $node->id());
$assert = $this->assertSession();
$assert->pageTextContains($block->label());
$assert->pageTextContains($node->getTitle());
}