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()); }
protected function prepareCustomVariable(CustomVariable $customVariable) { $data = array($customVariable->getIndex(), $customVariable->getName(), $customVariable->getValue(), $customVariable->getScope()); return $this->push('setCustomVar', $data); }
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; }