getMaxLengthCustomVariables() public static method

There are also some hardcoded places in JavaScript
public static getMaxLengthCustomVariables ( ) : integer
return integer
Esempio n. 1
0
 public function addCustomVariable()
 {
     $dbTable = $this->getDbTableName();
     $index = $this->getHighestCustomVarIndex() + 1;
     $maxLen = CustomVariables::getMaxLengthCustomVariables();
     Db::exec(sprintf('ALTER TABLE %s ', $dbTable) . sprintf('ADD COLUMN custom_var_k%d VARCHAR(%d) DEFAULT NULL,', $index, $maxLen) . sprintf('ADD COLUMN custom_var_v%d VARCHAR(%d) DEFAULT NULL;', $index, $maxLen));
     return $index;
 }
Esempio n. 2
0
 public static function truncateCustomVariable($input)
 {
     return substr(trim($input), 0, CustomVariables::getMaxLengthCustomVariables());
 }
Esempio n. 3
0
 public function test_getCustomVariablesInPageScope_ShouldTruncateValuesIfTheyAreTooLong()
 {
     $maxLen = CustomVariables::getMaxLengthCustomVariables();
     $customVars = $this->buildCustomVars(array('mykey' => 'myval', 'test' => str_pad('test', $maxLen + 5, 't')));
     $expected = $this->buildExpectedCustomVars(array('mykey' => 'myval', 'test' => str_pad('test', $maxLen, 't')));
     $this->assertCustomVariablesInPageScope($expected, $customVars);
 }
Esempio n. 4
0
 public function test_truncateCustomVariable_shouldActuallyTruncateTheValue()
 {
     $len = CustomVariables::getMaxLengthCustomVariables();
     $input = str_pad('test', $len + 2, 't');
     $this->assertGreaterThan(100, $len);
     $truncated = Request::truncateCustomVariable($input);
     $this->assertEquals(str_pad('test', $len, 't'), $truncated);
 }