You are here

public function PageTest::testGetNode in Hook Event Dispatcher 8

Test getNode() call.

File

tests/src/Unit/Preprocess/PageTest.php, line 94

Class

PageTest
Class PageTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Preprocess

Code

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