public function AcquiaLiftWebTestFundamentals::testConvertContextToFeatureString in Acquia Lift Connector 7
Tests the logic in AcquiaLiftAgent's implementation of convertContextToFeatureString().
File
- tests/
acquia_lift.test, line 1822 - Integration tests for Acquia Lift module.
Class
Code
public function testConvertContextToFeatureString() {
// No truncation should happen if name and value are short enough.
$name = $this
->randomName(20);
$value = $this
->randomName(20);
$string = AcquiaLiftAgent::convertContextToFeatureString($name, $value);
$expected = $name . '::' . $value;
$this
->assertEqual($expected, $string);
$string = AcquiaLiftAgent::convertContextToFeatureString($name, $value, TRUE);
$expected = $name . ':' . $value;
$this
->assertEqual($expected, $string);
// If we have a really long name and value test that they are truncated
// correctly.
$long_name = $this
->randomName(40);
$long_value = $this
->randomName(40);
$string = AcquiaLiftAgent::convertContextToFeatureString($long_name, $long_value);
$expected = substr($long_name, 0, 24) . '::' . substr($long_value, 0, 24);
$this
->assertEqual($expected, $string);
$string = AcquiaLiftAgent::convertContextToFeatureString($long_name, $long_value, TRUE);
$expected = substr($long_name, 0, 24) . ':' . substr($long_value, 0, 25);
$this
->assertEqual($expected, $string);
}