for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Behat\Context\Domain;
use Behat\Behat\Context\Context;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
/**
* @author Łukasz Chruściel <[email protected]>
final class OrderContext implements Context
{
* @var OrderRepositoryInterface
private $orderRepository;
* @param OrderRepositoryInterface $orderRepository
public function __construct(OrderRepositoryInterface $orderRepository)
$this->orderRepository = $orderRepository;
}
* @When I delete the order :orderNumber
public function iDeleteTheOrder($orderNumber)
/** @var OrderInterface $order */
$order = $this->orderRepository->findOneBy(['number' => $orderNumber]);
if (null === $order) {
throw new \InvalidArgumentException(sprintf('Order with %s number was not found in an order repository', $orderNumber));
$this->orderRepository->remove($order);
* @Then /^([^"]+) should not exist in the registry$/
public function orderShouldNotExistInTheRegistry(OrderInterface $order)
$order = $this->orderRepository->find($order->getId());
expect($order)->toBe(null);