You are here

public function GTMTestBase::testModule in GoogleTagManager 8

Test the module.

File

tests/src/Functional/GTMTestBase.php, line 74

Class

GTMTestBase
Tests the Google Tag Manager.

Namespace

Drupal\Tests\google_tag\Functional

Code

public function testModule() {
  try {
    $this
      ->modifySettings();

    // Create containers in code.
    $this
      ->createData();
    $this
      ->saveContainers();
    $this
      ->checkSnippetContents();
    $this
      ->checkPageResponse();

    // Delete containers.
    $this
      ->deleteContainers();

    // Create containers in user interface.
    $this
      ->submitContainers();
    $this
      ->checkSnippetContents();
    $this
      ->checkPageResponse();

    // Switch to inline snippets.
    $this
      ->modifySettings(FALSE);
    $this
      ->checkPageResponse();
  } catch (\Exception $e) {
    parent::assertTrue(TRUE, t('Inside CATCH block'));
    watchdog_exception('gtm_test', $e);
  } finally {
    parent::assertTrue(TRUE, t('Inside FINALLY block'));
  }
}