public function JsAssetTest::testPathWithSnippetFooter in Mautic Integration 8
Test the path with the js snippet in the footer
File
- tests/
src/ Functional/ JsAssetTest.php, line 83
Class
- JsAssetTest
- Functional tests for the Mautic module.
Namespace
Drupal\Tests\mautic\FunctionalCode
public function testPathWithSnippetFooter() {
// Page
$page = Url::fromRoute('entity.node_type.collection');
// Snippet in the footer
$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('header', 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
->assertTextInFooter('mautic.js', $currentPage
->getHtml());
}