Пример #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]);
 }