public function testCanInstantiateCustomeVariable()
 {
     $variable = new CustomVariable(1, 'var1', 'value1');
     $this->assertEquals(1, $variable->getIndex());
     $this->assertEquals('var1', $variable->getName());
     $this->assertEquals('value1', $variable->getValue());
     $this->assertEquals(CustomVariable::SCOPE_PAGE_LEVEL, $variable->getScope());
 }
Exemple #2
0
 protected function prepareCustomVariable(CustomVariable $customVariable)
 {
     $data = array($customVariable->getIndex(), $customVariable->getName(), $customVariable->getValue(), $customVariable->getScope());
     return $this->push('setCustomVar', $data);
 }
Exemple #3
0
 public function addCustomVariable(CustomVariable $variable)
 {
     $index = $variable->getIndex();
     if (array_key_exists($index, $this->customVariables)) {
         throw new InvalidArgumentException(sprintf('Cannot add custom variable with index %d, it already exists', $index));
     }
     $this->customVariables[$index] = $variable;
 }