You are here

public function PageContextTest::testGetAllWithSetByNode in Acquia Lift Connector 8

Tests the getAll() method, with setByNode().

@covers ::getAll @covers ::setByNode

File

tests/src/Unit/Service/Context/PageContextTest.php, line 112
Contains \Drupal\Tests\acquia_lift\Service\Context\PageContextTest.

Class

PageContextTest
PageContextTest Test.

Namespace

Drupal\Tests\acquia_lift\Service\Context

Code

public function testGetAllWithSetByNode() {
  $node = $this
    ->getNode();
  $this
    ->testGetAllWithSetByNodeSetUpThumbnailUrl($node);
  $this
    ->testGetAllWithSetByNodeSetUpFields();
  $page_context = new PageContext($this->configFactory, $this->entityTypeManager);
  $page_context
    ->setByNode($node);
  $all_page_context = $page_context
    ->getAll();
  $expected_page_context = [
    'content_title' => 'My Title',
    'content_type' => 'article',
    'page_type' => 'node page',
    'content_section' => 'Tracked Content Term Name 1',
    'content_keywords' => 'Tracked Keyword Term Name 1,Tracked Keyword Term Name 2',
    'post_id' => 90210,
    'published_date' => 'a_published_time',
    'thumbnail_url' => 'file_create_url:a_style_decorated_file_uri',
    'persona' => '',
    'engagement_score' => 1,
    'author' => 'a_username',
    'evalSegments' => TRUE,
    'trackingId' => '',
  ];
  $this
    ->assertEquals($expected_page_context, $all_page_context);
}