You are here

public function PageViewTest::testFacebookPixelIdMissing in Simple Facebook Pixel 8

Tests snippet insertion when Facebook Pixel is missing.

File

tests/src/Functional/PageViewTest.php, line 50

Class

PageViewTest
Tests PageView event.

Namespace

Drupal\Tests\simple_facebook_pixel\Functional

Code

public function testFacebookPixelIdMissing() {
  $this
    ->drupalGet('<front>');
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  /** @var \Drupal\simple_facebook_pixel\PixelBuilderServiceInterface $pixel_builder */
  $pixel_builder = \Drupal::service('simple_facebook_pixel.pixel_builder');
  $this
    ->assertSession()
    ->responseNotContains($pixel_builder
    ->getPixelScriptCode());
  $this
    ->assertSession()
    ->responseNotContains($pixel_builder
    ->getPixelNoScriptCode());
  $this
    ->drupalLogout();
  $this
    ->assertSession()
    ->responseNotContains($pixel_builder
    ->getPixelScriptCode());
  $this
    ->assertSession()
    ->responseNotContains($pixel_builder
    ->getPixelNoScriptCode());
}