Skip to content

Commit

Permalink
Fix Behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbager committed Feb 5, 2018
1 parent 033f11f commit 699353a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Repository/ShippingGatewayRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function findOneByCode(string $code): ?ShippingMethodInterface
public function findOneByShippingMethod(ShippingMethodInterface $shippingMethod): ?ShippingGatewayInterface
{
return $this->createQueryBuilder('o')
->where('o.shippingMethod = :shippingMethod')
->where(':shippingMethod MEMBER OF o.shippingMethods')
->setParameter('shippingMethod', $shippingMethod)
->getQuery()
->getOneOrNullResult()
Expand Down
28 changes: 14 additions & 14 deletions tests/Behat/Context/Setup/ShippingExportContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,6 @@ public function thoseOrdersWerePlacedWithShippingMethod($name)
}
}

/**
* @param ShipmentInterface $shipment
* @param ShippingGatewayInterface $shippingGateway
*/
private function addShippingExportForGateway(ShipmentInterface $shipment, ShippingGatewayInterface $shippingGateway)
{
/** @var ShippingExport $shippingExport */
$shippingExport = $this->shippingExportFactory->createNew();
$shippingExport->setShipment($shipment);
$shippingExport->setShippingGateway($shippingGateway);

$this->shippingExportRepository->add($shippingExport);
}

/**
* @Given those orders were completed
*/
Expand All @@ -160,4 +146,18 @@ public function newShippingExportsShouldBeCreated($number)
{
Assert::eq(count($this->shippingExportRepository->findAll()), $number);
}

/**
* @param ShipmentInterface $shipment
* @param ShippingGatewayInterface $shippingGateway
*/
private function addShippingExportForGateway(ShipmentInterface $shipment, ShippingGatewayInterface $shippingGateway)
{
/** @var ShippingExport $shippingExport */
$shippingExport = $this->shippingExportFactory->createNew();
$shippingExport->setShipment($shipment);
$shippingExport->setShippingGateway($shippingGateway);

$this->shippingExportRepository->add($shippingExport);
}
}
2 changes: 1 addition & 1 deletion tests/Behat/Context/Setup/ShippingGatewayContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function thereIsARegisteredShippingGatewayForThisShippingMethod($code, $n
/** @var ShippingMethodInterface $shippingMethod */
$shippingMethod = $this->sharedStorage->get('shipping_method');

$shippingGateway->setShippingMethod($shippingMethod);
$shippingGateway->addShippingMethod($shippingMethod);
$shippingGateway->setCode($code);
$shippingGateway->setLabel($name);
$shippingGateway->setConfig(['iban' => '123', 'address' => 'foo bar']);
Expand Down

0 comments on commit 699353a

Please sign in to comment.