public function testIsValidWithMissingValue() { $this->instance->setKey('mykey'); $this->instance->setType('param'); $this->instance->setName('myname'); $this->assertFalse($this->instance->isValid()); }
/** * Create a Customization instance. * * If you supply a string as the first arguments ($options) it will be used as the key for the Customization * and it will be added to this plugin. * If you supply an options array/object that contains a key the Customization will also be added to the plugin. * * When no key is supplied the Customization cannot be added, in that case you will need to add it manually * after setting the key, by using the addCustomization method. * * @param mixed $options * * @return Customization */ public function createCustomization($options = null) { if (is_string($options)) { $fq = new Customization(); $fq->setKey($options); } else { $fq = new Customization($options); } if ($fq->getKey() !== null) { $this->addCustomization($fq); } return $fq; }
public function testSetCustomizations() { $customization1 = new Customization(); $customization1->setKey('id1')->setName('test1'); $customization2 = new Customization(); $customization2->setKey('id2')->setName('test2'); $customizations1 = array('id1' => $customization1, 'id2' => $customization2); $this->plugin->addCustomizations($customizations1); $customization3 = new Customization(); $customization3->setKey('id3')->setName('test3'); $customization4 = new Customization(); $customization4->setKey('id4')->setName('test4'); $customizations2 = array('id3' => $customization3, 'id4' => $customization4); $this->plugin->setCustomizations($customizations2); $this->assertEquals($customizations2, $this->plugin->getCustomizations()); }