You are here

public function PardotFunctionalityTestCase::testCampaignJS in Pardot Integration 7

Same name and namespace in other branches
  1. 8 pardot.test \PardotFunctionalityTestCase::testCampaignJS()
  2. 7.2 pardot.test \PardotFunctionalityTestCase::testCampaignJS()

File

./pardot.test, line 46
Pardot web tests.

Class

PardotFunctionalityTestCase
Basic Pardot Test Case implementation.

Code

public function testCampaignJS() {

  // Add a campaign.
  $this
    ->drupalPost('admin/config/services/pardot/campaign', array(
    'campaign_id' => 34567,
    'name' => 'Test 1',
    'paths' => 'node',
  ), t('Add'));
  $this
    ->drupalGet('user');
  $this
    ->assertRaw('pardot.js"', 'Pardot default campaign added to non-campaign page.');
  $this
    ->drupalGet('node');
  $drupal_settings = $this
    ->drupalGetSettings();
  $this
    ->assertEqual($drupal_settings['pardot']['pardot_c_id'], '34567', 'Pardot Test 1 campaign added to campaign page.');

  // Modify a campaign.
  $this
    ->drupalPost("admin/config/services/pardot/campaign/34567/edit", array(
    'name' => 'Test 1',
    'paths' => 'user',
  ), t('Save'));
  $this
    ->drupalGet('user');
  $drupal_settings = $this
    ->drupalGetSettings();
  $this
    ->assertEqual($drupal_settings['pardot']['pardot_c_id'], '34567', 'Pardot Test 1 campaign added to capaign page after modification.');
  $this
    ->drupalGet('node');
  $drupal_settings = $this
    ->drupalGetSettings();
  $this
    ->assertEqual($drupal_settings['pardot']['pardot_c_id'], '23456', 'Pardot default campaign added to non-campaign page after modification.');

  // Delete a campaign.
  $this
    ->drupalPost("admin/config/services/pardot/campaign/34567/delete", array(), t('Delete'));
  $this
    ->drupalGet('user');
  $drupal_settings = $this
    ->drupalGetSettings();
  $this
    ->assertEqual($drupal_settings['pardot']['pardot_c_id'], '23456', 'Pardot default campaign added to capaign page after campaign deletion.');
  $this
    ->drupalPost('admin/config/services/pardot/campaign', array(
    'campaign_id' => 34567,
    'name' => 'node path test',
    'paths' => 'pardot_test_1',
  ), t('Add'));
  $this
    ->drupalCreateNode(array(
    'path' => array(
      'alias' => 'pardot_test_1',
    ),
  ));
  $this
    ->drupalGet('pardot_test_1');
  $drupal_settings = $this
    ->drupalGetSettings();
  $this
    ->assertEqual($drupal_settings['pardot']['pardot_c_id'], '34567', 'Pardot campaign added to aliased node.');
}