private function PageContextTest::getNode in Acquia Lift Connector 8.3
Same name and namespace in other branches
- 8.4 tests/src/Unit/Service/Context/PageContextTest.php \Drupal\Tests\acquia_lift\Unit\Service\Context\PageContextTest::getNode()
Get Node.
Parameters
integer $id:
Return value
Drupal\node\NodeInterface|\PHPUnit_Framework_MockObject_MockObject
4 calls to PageContextTest::getNode()
- PageContextTest::testPopulateHtmlHeadWithNode in tests/
src/ Unit/ Service/ Context/ PageContextTest.php - Tests the populate method, populateHtmlHead() sub method, with a Node.
- PageContextTest::testPopulateHtmlHeadWithNodeAndArrayTitle in tests/
src/ Unit/ Service/ Context/ PageContextTest.php - Tests the populate() method, populateHtmlHead() sub method, with a Node and array title.
- PageContextTest::testPopulateHtmlHeadWithNodeAndFields in tests/
src/ Unit/ Service/ Context/ PageContextTest.php - Tests the populate() method, populateHtmlHead() sub method, with a Node and fields.
- PageContextTest::testPopulateHtmlHeadWithNodeAndSimpleTitle in tests/
src/ Unit/ Service/ Context/ PageContextTest.php - Tests the populate() method, populateHtmlHead() sub method, with a Node and simple title.
File
- tests/
src/ Unit/ Service/ Context/ PageContextTest.php, line 499
Class
- PageContextTest
- PageContextTest Test.
Namespace
Drupal\Tests\acquia_lift\Unit\Service\ContextCode
private function getNode($id = 90210) {
$field_country = $this
->getMock('Drupal\\Core\\Field\\BaseFieldDefinition');
$field_tags = $this
->getMock('Drupal\\Core\\Field\\BaseFieldDefinition');
$node = $this
->getMock('Drupal\\node\\NodeInterface');
$field_country_handler_settings = [
'target_bundles' => [
'tracked_content_vocabulary',
],
];
$field_tags_handler_settings = [
'target_bundles' => [
'tracked_keyword_vocabulary',
],
];
$node
->expects($this
->once())
->method('getType')
->willReturn('article');
$node
->expects($this
->once())
->method('getTitle')
->willReturn('My Title');
$node
->expects($this
->once())
->method('getCreatedTime')
->willReturn('a_published_time');
$node
->expects($this
->any())
->method('id')
->willReturn($id);
$node
->expects($this
->once())
->method('uuid')
->willReturn('ecf826eb-3ef0-4aa6-aae2-9f6e5886bbb6');
$field_country
->expects($this
->once())
->method('getSetting')
->with('handler_settings')
->willReturn($field_country_handler_settings);
$field_tags
->expects($this
->once())
->method('getSetting')
->with('handler_settings')
->willReturn($field_tags_handler_settings);
$node->field_country = $field_country;
$node->field_tags = $field_tags;
return $node;
}