public function testSetAndGetKey() { $value = 'mykey'; $this->instance->setKey($value); $this->assertEquals($value, $this->instance->getKey()); }
/** * Add a customization. * * Supports a Customization instance or a config array, in that case a new * Customization instance wil be created based on the options. * * @throws InvalidArgumentException * * @param Customization|array $customization * * @return self Provides fluent interface */ public function addCustomization($customization) { if (is_array($customization)) { $customization = new Customization($customization); } $key = $customization->getKey(); // check for non-empty key if (0 === strlen($key)) { throw new InvalidArgumentException('A Customization must have a key value'); } // check for a unique key if (array_key_exists($key, $this->customizations)) { //double add calls for the same customization are ignored, others cause an exception if ($this->customizations[$key] !== $customization) { throw new InvalidArgumentException('A Customization must have a unique key value'); } } $this->customizations[$key] = $customization; return $this; }