function it_should_remove_a_specific_TSProperty() { $tsProp = new TSProperty(); $tsProp->setName('foo'); $tsProp->setValue('bar'); $this->add($tsProp); $this->has('foo')->shouldEqual(true); $this->remove('foo'); $this->has('foo')->shouldEqual(false); }
/** * Construct in one of the following ways: * * - Pass an array of TSProperty key => value pairs (See DEFAULTS constant). * - Pass the TSPropertyArray binary value. The object representation of that will be decoded and constructed. * - Pass nothing and a default set of TSProperty key => value pairs will be used (See DEFAULTS constant). * * @param mixed $tsPropertyArray */ public function __construct($tsPropertyArray = null) { if (is_null($tsPropertyArray) || is_array($tsPropertyArray)) { $tsPropertyArray = $tsPropertyArray ?: self::DEFAULTS; foreach ($tsPropertyArray as $key => $value) { $tsProperty = new TSProperty(); $tsProperty->setName($key); $tsProperty->setValue($value); $this->tsProperty[$key] = $tsProperty; } } else { $this->decode($tsPropertyArray); } }