/** * Test for __toString method */ public function testToString() { $newCode = 'toStringCode'; $expectedCode = '[' . $newCode . ']'; $this->type->setCode($newCode); $this->assertEquals($expectedCode, $this->type->__toString()); $newLabel = 'toStringLabel'; $this->assertEntity($this->type->setLocale('en_US')); $this->assertEntity($this->type->setLabel($newLabel)); $this->assertEquals($newLabel, $this->type->__toString()); $this->type->setLocale('fr_FR'); $this->assertEquals($expectedCode, $this->type->__toString()); $this->type->setLabel(''); $this->assertEquals($expectedCode, $this->type->__toString()); }
/** * @param string $code * @param string $label * @param bool $isVariant * * @return \Pim\Bundle\CatalogBundle\Model\GroupTypeInterface */ protected function createGroupType($code, $label, $isVariant) { $type = new GroupType(); $type->setCode($code); $type->setVariant($isVariant); $type->setLocale('en_US')->setLabel($label); $this->validate($type); $this->persist($type); return $type; }
/** * {@inheritDoc} */ public function setLocale($locale) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setLocale', array($locale)); return parent::setLocale($locale); }
/** * @param string $code * @param string $label * @param bool $isVariant * * @return \Pim\Component\Catalog\Model\GroupTypeInterface */ protected function createGroupType($code, $label, $isVariant) { $type = new GroupType(); $type->setCode($code); $type->setVariant($isVariant); $type->setLocale('en_US')->setLabel($label); $this->validate($type); $this->getContainer()->get('pim_catalog.saver.group_type')->save($type); return $type; }