function it_returns_available_variants(ProductVariantInterface $unavailableVariant, ProductVariantInterface $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); }