Exemplo n.º 1
0
 public function testCreate()
 {
     $product = $this->dummyData->getProduct();
     $option = $this->dummyData->getOption();
     $textOption = $this->dummyData->getTextOption();
     $image = $this->dummyData->getImage();
     $image->setPath('http://lorempixel.com/400/200/');
     $tag = new Tag();
     $tag->setName('Test Tag');
     $tag->setCode('TT');
     $tag->setDescription('Test Description');
     $tag->setDefaultImage(null);
     $tag->setSortOrder(0);
     $tag->setIsVisible(true);
     $tag->setIsActive(true);
     $tag->addProduct($product);
     $tag->addImage($image);
     $tag->addOption($option);
     $tag->addTextOption($textOption);
     $this->assertEntityValid($tag);
     $this->assertSame('Test Tag', $tag->getName());
     $this->assertSame('TT', $tag->getCode());
     $this->assertSame('Test Description', $tag->getDescription());
     $this->assertSame('http://lorempixel.com/400/200/', $tag->getDefaultImage());
     $this->assertSame(0, $tag->getSortOrder());
     $this->assertTrue($tag->isVisible());
     $this->assertTrue($tag->isActive());
     $this->assertSame($product, $tag->getProducts()[0]);
     $this->assertSame($image, $tag->getImages()[0]);
     $this->assertSame($option, $tag->getOptions()[0]);
     $this->assertSame($textOption, $tag->getTextOptions()[0]);
 }
Exemplo n.º 2
0
 public static function setFromDTO(Tag &$tag, TagDTO $tagDTO)
 {
     $tag->setName($tagDTO->name);
     $tag->setDefaultImage($tagDTO->defaultImage);
     $tag->setCode($tagDTO->code);
     $tag->setDescription($tagDTO->description);
     $tag->setIsActive($tagDTO->isActive);
     $tag->setIsVisible($tagDTO->isVisible);
     $tag->setAreAttachmentsEnabled($tagDTO->areAttachmentsEnabled);
     $tag->setSortOrder($tagDTO->sortOrder);
 }
Exemplo n.º 3
0
 public function getTag()
 {
     $tag = new Tag();
     $tag->setName('Test Tag');
     $tag->setCode('TT' . uniqid());
     $tag->setDescription('Test Description');
     $tag->setDefaultImage('http://lorempixel.com/400/200/');
     $tag->setSortOrder(0);
     $tag->setIsActive(true);
     $tag->setIsVisible(true);
     return $tag;
 }