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);
 }
Example #2
0
 function it_recognizes_a_subject_as_not_eligible_if_a_product_taxon_is_not_matched(OrderInterface $subject, OrderItemInterface $item, ProductInterface $reflexBow, ProductTaxonInterface $reflexBowProductTaxon, TaxonInterface $bows)
 {
     $configuration = ['taxons' => ['swords', 'axes']];
     $bows->getCode()->willReturn('bows');
     $reflexBow->getProductTaxons()->willReturn([$reflexBowProductTaxon]);
     $reflexBowProductTaxon->getTaxon()->willReturn($bows);
     $item->getProduct()->willReturn($reflexBow);
     $subject->getItems()->willReturn([$item]);
     $this->isEligible($subject, $configuration)->shouldReturn(false);
 }
Example #3
0
 function it_filters_passed_order_items_with_given_configuration(OrderItemInterface $item1, OrderItemInterface $item2, ProductInterface $product1, ProductInterface $product2, TaxonInterface $taxon1, TaxonInterface $taxon2, ProductTaxonInterface $productTaxon1, ProductTaxonInterface $productTaxon2)
 {
     $item1->getProduct()->willReturn($product1);
     $product1->getProductTaxons()->willReturn([$productTaxon1]);
     $productTaxon1->getTaxon()->willReturn($taxon1);
     $taxon1->getCode()->willReturn('taxon1');
     $item2->getProduct()->willReturn($product2);
     $product2->getProductTaxons()->willReturn([$productTaxon2]);
     $productTaxon2->getTaxon()->willReturn($taxon2);
     $taxon2->getCode()->willReturn('taxon2');
     $this->filter([$item1, $item2], ['filters' => ['taxons_filter' => ['taxons' => ['taxon1']]]])->shouldReturn([$item1]);
 }
 function it_transforms_product_taxon_to_taxon(ProductTaxonInterface $productTaxon, TaxonInterface $taxon)
 {
     $productTaxon->getTaxon()->willReturn($taxon);
     $this->transform($productTaxon)->shouldReturn($taxon);
 }