You are here

public function LiftCustomFieldTest::testPathWithoutLiftSnippet in Mautic Integration 8

Test the path without the Acquia Personalization Integration snippet

File

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

Class

LiftCustomFieldTest
Functional tests for the Mautic module.

Namespace

Drupal\Tests\mautic\Functional

Code

public function testPathWithoutLiftSnippet() {

  // 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', false)
    ->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
    ->assertStringNotContainsString('mautic.customFields.js', $currentPage
    ->getHtml());
}