You are here

public function AcquiaLiftWebTestAgentAdmin::testSyncGoalsFromCampaignUI in Acquia Lift Connector 7

File

tests/acquia_lift.test, line 1283
Integration tests for Acquia Lift module.

Class

AcquiaLiftWebTestAgentAdmin

Code

public function testSyncGoalsFromCampaignUI() {
  $agent = $this
    ->createTestAgent();
  $edit = array(
    'goals[0][action_name]' => 'form_submit',
    'goals[0][value]' => '20',
  );
  $this
    ->drupalPost('admin/structure/personalize/manage/' . $agent
    ->getMachineName() . '/edit', $edit, $this
    ->getButton('goal'));
  $expected_queues = array(
    array(
      'method' => 'saveGoal',
      'args' => array(
        $agent
          ->getMachineName(),
        'form_submit',
      ),
      'agent' => $agent
        ->getMachineName(),
    ),
    array(
      'method' => 'saveAgent',
      'args' => array(
        $agent
          ->getMachineName(),
        $agent
          ->getTitle(),
        'adaptive',
        PERSONALIZE_STATUS_NOT_STARTED,
        0.1,
        0.2,
        1,
      ),
      'agent' => $agent
        ->getMachineName(),
    ),
  );
  $this
    ->assertQueueItems($expected_queues);
  $this->personalizedQueue
    ->deleteQueue();
  $this
    ->drupalPost('admin/structure/personalize/manage/' . $agent
    ->getMachineName() . '/edit', array(), $this
    ->getButton('goal'));

  // As we're triggering only goals form and do not change anything
  // saveAgent won't be invoked also
  $expected_queues = array();
  $this
    ->assertQueueItems($expected_queues);
  $this->personalizedQueue
    ->deleteQueue();
}