/** * test relatede method */ public function testAddMissingProductValues() { $builder = $this->getProductBuilder(); $product = new Product(); $this->assertEquals(count($product->getValues()), 0); $family = new Family(); $attribute = new Attribute(); $attribute->setCode('one'); $family->addAttribute($attribute); $product->setFamily($family); $builder->addMissingProductValues($product); $this->assertValues($product, array('one')); $attributeTwo = new Attribute(); $attributeTwo->setCode('two'); $attributeTwo->setLocalizable(true); $family->addAttribute($attributeTwo); $builder->addMissingProductValues($product); $this->assertValues($product, array('one', 'twoen_US', 'twofr_FR')); $attributeThree = new Attribute(); $attributeThree->setCode('three'); $attributeThree->setScopable(true); $family->addAttribute($attributeThree); $builder->addMissingProductValues($product); $this->assertValues($product, array('one', 'twoen_US', 'twofr_FR', 'threeecom', 'threeprint')); $attributeFour = new Attribute(); $attributeFour->setCode('four'); $attributeFour->setLocalizable(true); $attributeFour->setScopable(true); $family->addAttribute($attributeFour); $builder->addMissingProductValues($product); $this->assertValues($product, array('one', 'twoen_US', 'twofr_FR', 'threeecom', 'threeprint', 'fouren_USecom', 'fouren_USprint', 'fourfr_FRecom', 'fourfr_FRprint')); }
/** * Test related method */ public function testNullAttributeLabel() { $attribute = $this->getAttributeMock(); $family = $this->getFamilyMock(null); $value = $this->getValueMock($attribute, 'bar'); $sku = $this->getValueMock($this->getAttributeMock(null, 'pim_catalog_identifier'), 'foo-bar'); $this->product->addValue($sku); $this->product->setFamily($family); $this->product->addValue($value); $this->assertEquals('foo-bar', $this->product->getLabel()); }
/** * {@inheritDoc} */ public function setFamily(\Pim\Bundle\CatalogBundle\Model\FamilyInterface $family = NULL) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setFamily', array($family)); return parent::setFamily($family); }