/** * {@inheritdoc} */ public function resolve(TaxableInterface $taxable, array $criteria = []) { if (null === ($category = $taxable->getTaxCategory())) { return null; } $criteria = array_merge(['category' => $category], $criteria); return $this->taxRateRepository->findOneBy($criteria); }
function it_returns_null_if_taxable_does_not_belong_to_any_category(TaxableInterface $taxable) { $taxable->getTaxCategory()->willReturn(null); $this->resolve($taxable)->shouldReturn(null); }