You are here

public function PageTest::testGetNode in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/preprocess_event_dispatcher/tests/src/Unit/PageTest.php \Drupal\Tests\preprocess_event_dispatcher\Unit\PageTest::testGetNode()

Test getNode() call.

File

modules/preprocess_event_dispatcher/tests/src/Unit/PageTest.php, line 79

Class

PageTest
Class PageTest.

Namespace

Drupal\Tests\preprocess_event_dispatcher\Unit

Code

public function testGetNode() : void {
  $vars = [];
  $page = new PageEventVariables($vars);
  self::assertNull($page
    ->getNode());
  $page
    ->set('node', new stdClass());
  self::assertNull($page
    ->getNode());
  $vars['node'] = Mockery::mock(NodeInterface::class);
  self::assertInstanceOf(NodeInterface::class, $page
    ->getNode());
}