You are here

function acquia_lift_get_retired_tests in Acquia Lift Connector 7.2

Returns any retired tests that exist for the specified agent.

Parameters

$agent_name: The agent to get retired tests for.

Return value

array An array of test objects for the specified agent, or if no agent was specified an associative array whose keys are parent agents and whose values are arrays of test objects.

8 calls to acquia_lift_get_retired_tests()
AcquiaLiftWebTestReports::testAudienceReportLogic in tests/acquia_lift.test
AcquiaLiftWebTestReports::testReportPage in tests/acquia_lift.test
AcquiaLiftWebTestTarget::testAudienceChanges in tests/acquia_lift.test
AcquiaLiftWebTestTarget::testImplementTargetingStructure in tests/acquia_lift.test
acquia_lift_agent_delete_access in ./acquia_lift.module
Access callback for agent deletion.

... See full list

File

./acquia_lift.admin.inc, line 2266
acquia_lift.admin.inc Provides functions needed for the admin UI.

Code

function acquia_lift_get_retired_tests($agent_name = NULL) {
  $old_tests =& drupal_static(__FUNCTION__, NULL);
  if ($old_tests == NULL) {
    $old_tests = array();
    $test_agents = personalize_agent_load_by_type(ACQUIA_LIFT_TESTING_AGENT);
    foreach ($test_agents as $name => $agent) {
      if (isset($agent->data['lift_parent'])) {
        if (!isset($old_tests[$agent->data['lift_parent']])) {
          $old_tests[$agent->data['lift_parent']] = array();
        }
        $old_tests[$agent->data['lift_parent']][] = $agent;
      }
    }
  }
  if (!empty($agent_name)) {
    return isset($old_tests[$agent_name]) ? $old_tests[$agent_name] : array();
  }
  return $old_tests;
}