You are here

public function AcquiaLiftWebTestAgentAdmin::testUpdateAgentStatus in Acquia Lift Connector 7

File

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

Class

AcquiaLiftWebTestAgentAdmin

Code

public function testUpdateAgentStatus() {
  $agent = $this
    ->createTestAgent();
  $agent_name = $agent
    ->getMachineName();

  // Manually set the agent's status to running, bypassing the verification check.
  variable_set(_personalize_agent_get_status_variable($agent_name), PERSONALIZE_STATUS_RUNNING);
  $this
    ->resetAll();

  // Now use the API function to update the status.
  personalize_agent_set_status($agent_name, PERSONALIZE_STATUS_PAUSED);
  $expected_queues = array(
    array(
      'method' => 'updateAgentStatus',
      'args' => array(
        $agent_name,
        PERSONALIZE_STATUS_PAUSED,
      ),
      'agent' => $agent_name,
    ),
  );
  $this
    ->assertQueueItems($expected_queues);
  $this->personalizedQueue
    ->deleteQueue();
}