public function __construct(BankAccountInterface $bankAccount, $specKnown, $specResult) { try { Assert::boolean($specKnown, 'specKnown should be a boolean, got: `%s`'); if (true === $specKnown) { Assert::boolean($specResult, 'specResult should be a boolean, got: `%s`'); } else { Assert::null($specResult, 'specResult should be null, got: `%s`'); } } catch (\InvalidArgumentException $e) { throw E::wrap($e); } $this->bankAccount = $bankAccount; $this->specKnown = $specKnown; $this->specResult = $specResult; }
/** * @Then /^(this promotion) should no longer exist in the promotion registry$/ */ public function promotionShouldNotExistInTheRegistry(PromotionInterface $promotion) { Assert::null($this->promotionRepository->findOneBy(['code' => $promotion->getCode()])); }
/** * @Then /^(this coupon) should no longer exist in the coupon registry$/ */ public function couponShouldNotExistInTheRegistry(CouponInterface $coupon) { Assert::null($this->couponRepository->findOneBy(['code' => $coupon->getCode()]), sprintf('The coupon with code %s should not exist', $coupon->getCode())); }
/** * @Then this variant should not exist in the product catalog */ public function productVariantShouldNotExistInTheProductCatalog() { $productVariantId = $this->sharedStorage->get('product_variant_id'); $productVariant = $this->productVariantRepository->find($productVariantId); Assert::null($productVariant); }
/** * @Then this order should not exist in the registry */ public function orderShouldNotExistInTheRegistry() { $orderId = $this->sharedStorage->get('order_id'); $order = $this->orderRepository->find($orderId); Assert::null($order); }
/** * @Then /^(this variant) should not exist in the product catalog$/ */ public function productVariantShouldNotExistInTheProductCatalog(ProductVariantInterface $productVariant) { Assert::null($this->productVariantRepository->findOneBy(['code' => $productVariant->getCode()])); }
/** * @Then there is no :class document at :path */ public function thereIsNoDocumentAt($class, $path) { $class = 'Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\' . $class; $path = '/tests' . $path; if (!class_exists($class)) { throw new \InvalidArgumentException(sprintf('Class "%s" does not exist', $class)); } $this->session->refresh(true); $this->manager->clear(); $document = $this->manager->find($class, $path); Assert::null($document, sprintf('A "%s" document does exist at "%s".', $class, $path)); }
/** * @Then /^(this cart) should be automatically deleted$/ */ public function thisCartShouldBeAutomaticallyDeleted(OrderInterface $cart) { $this->expiredCartsRemover->remove(); Assert::null($cart->getId(), 'This cart should not exist in registry but it does.'); }
/** * @Then /^([^"]+) should not exist in the registry$/ */ public function orderShouldNotExistInTheRegistry(OrderInterface $order) { /** @var OrderInterface $order */ $order = $this->orderRepository->findOneBy(['number' => $order->getNumber()]); Assert::null($order); }