You are here

function PardotFunctionalityTestCase::_testCampaignJS in Pardot Integration 6

1 call to PardotFunctionalityTestCase::_testCampaignJS()
PardotFunctionalityTestCase::testSettingsAndJSAddition in ./pardot.test
Verify that settings work and that basic JS Addition is functional.

File

./pardot.test, line 53

Class

PardotFunctionalityTestCase
Basic Pardot Test Case implementation.

Code

function _testCampaignJS() {

  // Add a campaign.
  $this
    ->drupalPost('admin/settings/pardot/campaign', array(
    'campaign_id' => 34567,
    'name' => 'Test 1',
    'paths' => 'node',
  ), t('Add'));
  $this
    ->drupalGet('user');
  $this
    ->assertRaw('piCId = "23456"', 'Pardot default campaign added to non-campaign page.');
  $this
    ->drupalGet('node');
  $this
    ->assertRaw('piCId = "34567"', 'Pardot Test 1 campaign added to capaign page.');

  // Modify a campaign.
  $this
    ->drupalPost("admin/settings/pardot/campaign/34567/edit", array(
    'name' => 'Test 1',
    'paths' => 'user/*',
  ), t('Save'));
  $this
    ->drupalGet('user');
  $this
    ->assertRaw('piCId = "34567"', 'Pardot Test 1 campaign added to capaign page after modification.');
  $this
    ->drupalGet('node');
  $this
    ->assertRaw('piCId = "23456"', 'Pardot default campaign added to non-campaign page after modification.');

  // Delete a campaign.
  $this
    ->drupalPost("admin/settings/pardot/campaign/34567/delete", array(), t('Delete'));
  $this
    ->drupalGet('user');
  $this
    ->assertRaw('piCId = "23456"', 'Pardot default campaign added to capaign page after campaign deletion.');
  $this
    ->drupalPost('admin/settings/pardot/campaign', array(
    'campaign_id' => 34567,
    'name' => 'node path test',
    'paths' => 'pardot_test_1',
  ), t('Add'));
  $node = $this
    ->drupalCreateNode(array(
    'path' => 'pardot_test_1',
  ));
  $this
    ->drupalGet('pardot_test_1');
  $this
    ->assertRaw('piCId = "34567"', 'Pardot campaign added to aliased node.');
}