コード例 #1
0
 public function matches(CartItem $cartItem)
 {
     foreach ($cartItem->getProduct()->getTags() as $tag) {
         if ($tag->getId() === $this->tag->getId() and $cartItem->getQuantity() >= $this->quantity) {
             return true;
         }
     }
     return false;
 }
コード例 #2
0
 public function isTagValid(Product $product)
 {
     if ($this->tag === null) {
         return true;
     }
     foreach ($product->getTags() as $tag) {
         if ($tag->getId() !== null and $tag->getId() == $this->tag->getId()) {
             return true;
         }
     }
     return false;
 }
コード例 #3
0
ファイル: TagTest.php プロジェクト: inklabs/kommerce-core
 public function testCreateDefaults()
 {
     $tag = new Tag();
     $this->assertTrue($tag->getId() instanceof UuidInterface);
     $this->assertTrue($tag->getCreated() instanceof DateTime);
     $this->assertSame(null, $tag->getUpdated());
     $this->assertSame(null, $tag->getName());
     $this->assertSame(null, $tag->getCode());
     $this->assertSame(null, $tag->getDescription());
     $this->assertSame(null, $tag->getDefaultImage());
     $this->assertSame(false, $tag->isActive());
     $this->assertSame(false, $tag->isVisible());
     $this->assertSame(false, $tag->areAttachmentsEnabled());
     $this->assertSame(0, $tag->getSortOrder());
     $this->assertSame(0, count($tag->getProducts()));
     $this->assertSame(0, count($tag->getImages()));
     $this->assertSame(0, count($tag->getOptions()));
     $this->assertSame(0, count($tag->getTextOptions()));
 }