function it_transforms_taxons_collection_to_product_taxons_collection(ProductTaxonInterface $productTaxon, TaxonInterface $taxon, FactoryInterface $productTaxonFactory) { $productTaxons = new ArrayCollection([$productTaxon->getWrappedObject()]); $taxons = new ArrayCollection([$taxon->getWrappedObject()]); $productTaxonFactory->createNew()->willReturn($productTaxon); $productTaxon->setTaxon($taxon)->shouldBeCalled(); $this->reverseTransform($taxons)->shouldBeCollection($productTaxons); }
function it_throws_exception_while_reverse_transform_if_taxons_element_is_not_an_array(TaxonInterface $axes) { $this->shouldThrow(new \InvalidArgumentException('"taxons" element of collection should be Traversable'))->during('reverseTransform', [new ArrayCollection(['taxons' => $axes->getWrappedObject()])]); }
function it_reverse_transforms_into_array_of_taxons_codes(TaxonInterface $axes, TaxonInterface $shields) { $axes->getCode()->willReturn('axes'); $shields->getCode()->willReturn('shields'); $this->reverseTransform(new ArrayCollection([$axes->getWrappedObject(), $shields->getWrappedObject()]))->shouldReturn(['axes', 'shields']); }