Пример #1
0
 function its_hasVariants_should_return_true_only_if_any_variants_defined(VariantInterface $variant)
 {
     $variant->isMaster()->willReturn(false);
     $variant->setProduct($this)->shouldBeCalled();
     $this->addVariant($variant);
     $this->hasVariants()->shouldReturn(true);
 }
Пример #2
0
 function it_returns_available_variants(VariantInterface $unavailableVariant, VariantInterface $variant)
 {
     $unavailableVariant->isAvailable()->willReturn(false);
     $variant->isAvailable()->willReturn(true);
     $unavailableVariant->setProduct($this)->shouldBeCalled();
     $variant->setProduct($this)->shouldBeCalled();
     $this->addVariant($unavailableVariant);
     $this->addVariant($variant);
     $this->getAvailableVariants()->shouldHaveCount(1);
     $this->getAvailableVariants()->first()->shouldReturn($variant);
 }