Example #1
0
 public function testIsRelatedTo()
 {
     $notRelatedProduct = Product::getNewInstance($this->productCategory);
     $notRelatedProduct->save();
     $relatedProduct = Product::getNewInstance($this->productCategory);
     $relatedProduct->save();
     $this->product->addRelatedProduct($relatedProduct);
     $this->product->save();
     $this->assertFalse($notRelatedProduct->isRelatedTo($this->product, ProductRelationship::TYPE_CROSS));
     $this->assertTrue($relatedProduct->isRelatedTo($this->product, ProductRelationship::TYPE_CROSS));
     // isRelatedTo provide one direction testing is related to means that
     // this product is in that product's related products list
     $this->assertFalse($this->product->isRelatedTo($relatedProduct, ProductRelationship::TYPE_CROSS));
 }