예제 #1
0
 function it_recognizes_a_subject_as_not_eligible_if_a_product_taxon_is_not_matched(OrderInterface $subject, OrderItemInterface $item, ProductInterface $reflexBow, TaxonInterface $bows)
 {
     $configuration = ['taxons' => ['swords', 'axes']];
     $bows->getCode()->willReturn('bows');
     $reflexBow->getTaxons()->willReturn([$bows]);
     $item->getProduct()->willReturn($reflexBow);
     $subject->getItems()->willReturn([$item]);
     $this->isEligible($subject, $configuration)->shouldReturn(false);
 }
예제 #2
0
 /**
  * @param ProductInterface $product
  * @param array $taxons
  *
  * @return bool
  */
 private function hasProductValidTaxon(ProductInterface $product, array $taxons)
 {
     foreach ($product->getTaxons() as $taxon) {
         if (in_array($taxon->getCode(), $taxons)) {
             return true;
         }
     }
     return false;
 }