Skip to content

Commit

Permalink
Add fixes for behats
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomanhez committed Feb 10, 2020
1 parent be08c3b commit 9095050
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ Feature: Seeing basic information about shipment

@ui
Scenario: Seeing basic information about shipment
When I view the shipment of the order "#00000001"
When I view the first shipment of the order "#00000001"
Then I should see 2 "Apple" items in it
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function iFilter(): void
}

/**
* @When I view the shipment of the order :order
* @When I view the first shipment of the order :order
*/
public function iViewTheShipmentOfTheOrder(OrderInterface $order): void
{
Expand Down Expand Up @@ -200,6 +200,6 @@ public function iShouldSeeShipmentForTheOrderInTheList(string $orderNumber, int
*/
public function iShouldSeeItemsInIt(int $amountOf, ProductInterface $product): void
{
$this->shipmentShowPage->hasShipmentUnit($amountOf, $product);
Assert::true($amountOf === $this->shipmentShowPage->getAmountOfShipmentUnits($product));
}
}
4 changes: 2 additions & 2 deletions src/Sylius/Behat/Page/Admin/Shipment/ShowPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public function getRouteName(): string
return 'sylius_admin_shipment_show';
}

public function hasShipmentUnit(int $amountOf, ProductInterface $product): bool
public function getAmountOfShipmentUnits(ProductInterface $product): int
{
$table = $this->getElement('shipment_table');

return $amountOf === count($table->findAll('css', sprintf('td:contains("%s")', $product->getName())));
return count($table->findAll('css', sprintf('td:contains("%s")', $product->getName())));
}

protected function getDefinedElements(): array
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Behat/Page/Admin/Shipment/ShowPageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@

interface ShowPageInterface extends PageInterface
{
public function hasShipmentUnit(int $amountOf, ProductInterface $product): bool;
public function getAmountOfShipmentUnits(ProductInterface $product): int;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
</div>
{{ form_row(form._token) }}
{{ form_end(form, {'render_rest': false}) }}
src/Sylius/Behat/Context/Ui/Admin/ManagingShipmentsContext.php

0 comments on commit 9095050

Please sign in to comment.