You are here

public function LiftCustomFieldTest::testPathWithLiftSnippet in Mautic Integration 8

Test the path with the Acquia Personalization Integration snippet

File

tests/src/Functional/LiftCustomFieldTest.php, line 61

Class

LiftCustomFieldTest
Functional tests for the Mautic module.

Namespace

Drupal\Tests\mautic\Functional

Code

public function testPathWithLiftSnippet() {

  // Page
  $page = Url::fromRoute('entity.node_type.collection');

  // Snippet in the header
  $this->config
    ->set('visibility.request_path_mode', 1)
    ->set('mautic_base_url', 'https:/mautic.test/mtc.js')
    ->set('visibility.request_path_pages', '/' . $page
    ->getInternalPath())
    ->set('lift_enable', true)
    ->save();

  // Start the session.
  $session = $this
    ->assertSession();

  // Navigate to the page
  $this
    ->drupalGet($page);

  // Assure the page was loaded
  $session
    ->statusCodeEquals(200);

  // Check if the snippet is in the code
  $currentPage = $this
    ->getSession()
    ->getPage();
  $this
    ->assertStringContainsString('mautic.customFields.js', $currentPage
    ->getHtml());
}