public function PageViewTest::testFacebookPixelDisabled in Simple Facebook Pixel 8
Tests snippet insertion when Facebook Pixel is disabled.
File
- tests/
src/ Functional/ PageViewTest.php, line 68
Class
- PageViewTest
- Tests PageView event.
Namespace
Drupal\Tests\simple_facebook_pixel\FunctionalCode
public function testFacebookPixelDisabled() {
$edit['pixel_enabled'] = FALSE;
$edit['pixel_id'] = '789012';
$this
->drupalPostForm('admin/config/system/simple-facebook-pixel', $edit, 'Save configuration');
$this
->assertSession()
->responseContains('The configuration options have been saved.');
/** @var \Drupal\simple_facebook_pixel\PixelBuilderServiceInterface $pixel_builder */
$pixel_builder = \Drupal::service('simple_facebook_pixel.pixel_builder');
$this
->drupalGet('<front>');
$this
->assertSession()
->statusCodeEquals(200);
$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());
}