You are here

public function AcquiaLiftWebTestFundamentals::testMachineNameValidation in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 tests/acquia_lift.test \AcquiaLiftWebTestFundamentals::testMachineNameValidation()

Tests that new agents on the site cannot override existing agents in Lift.

File

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

Class

AcquiaLiftWebTestFundamentals

Code

public function testMachineNameValidation() {
  $test_data = array(
    'agents' => array(
      array(
        'code' => 'my-existing-agent',
      ),
    ),
  );
  variable_set('acquia_lift_web_test_data', $test_data);

  // Try to create a new agent with the same name as one that exists in Lift.
  $this
    ->createTestAgent(array(
    'name' => 'my-existing-agent',
    'control_rate' => 10,
    'explore_rate' => 30,
  ), TRUE, FALSE);
  $this
    ->resetAll();
  $agent = personalize_agent_load_agent('my-existing-agent');
  $this
    ->assertNull($agent);
  $agent = personalize_agent_load_agent('my-existing-agent-0');
  $this
    ->assertTrue($agent instanceof AcquiaLiftAgentInterface);
}