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\Transform;
use Behat\Behat\Context\Context;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
use Webmozart\Assert\Assert;
/**
* @author Grzegorz Sadowski <[email protected]>
final class OrderContext implements Context
{
* @var OrderRepositoryInterface
private $orderRepository;
* @param OrderRepositoryInterface $orderRepository
public function __construct(OrderRepositoryInterface $orderRepository)
$this->orderRepository = $orderRepository;
}
* @Transform :order
public function getOrderByNumber($orderNumber)
$order = $this->orderRepository->findOneBy(['number' => $orderNumber]);
Assert::notNull($order, sprintf('Cannot find order with number %s', $orderNumber));
return $order;