/** * Test getter/setter for color property */ public function testGetSetColor() { $this->assertEmpty($this->channel->getColor()); // change value and assert new $newColor = '25,25,112'; $this->assertEntity($this->channel->setColor($newColor)); $this->assertEquals($newColor, $this->channel->getColor()); }
/** * @param array $data * * @return Channel */ protected function createChannel($data) { if (is_string($data)) { $data = [['code' => $data]]; } $data = array_merge(['label' => null, 'color' => null, 'currencies' => null, 'locales' => null, 'tree' => null], $data); $channel = new Channel(); $channel->setCode($data['code']); $channel->setLabel($data['label']); if ($data['color']) { $channel->setColor($data['color']); } foreach ($this->listToArray($data['currencies']) as $currencyCode) { $channel->addCurrency($this->getCurrency($currencyCode)); } foreach ($this->listToArray($data['locales']) as $localeCode) { $channel->addLocale($this->getLocale($localeCode)); } if ($data['tree']) { $channel->setCategory($this->getCategory($data['tree'])); } $this->validate($channel); $this->persist($channel); }
/** * {@inheritDoc} */ public function setColor($color) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setColor', array($color)); return parent::setColor($color); }