1 | <?php |
||
30 | final class ManagingShipmentsContext implements Context |
||
31 | { |
||
32 | /** @var ApiClientInterface */ |
||
33 | private $client; |
||
34 | |||
35 | /** @var ApiIriClientInterface */ |
||
36 | private $iriClient; |
||
37 | |||
38 | /** @var ResponseCheckerInterface */ |
||
39 | private $responseChecker; |
||
40 | |||
41 | /** @var IriConverterInterface */ |
||
42 | private $iriConverter; |
||
43 | |||
44 | public function __construct( |
||
55 | |||
56 | /** |
||
57 | * @When I browse shipments |
||
58 | */ |
||
59 | public function iBrowseShipments(): void |
||
63 | |||
64 | /** |
||
65 | * @When I choose :state as a shipment state |
||
66 | */ |
||
67 | public function iChooseShipmentState(string $state): void |
||
71 | |||
72 | /** |
||
73 | * @When I choose :channel as a channel filter |
||
74 | */ |
||
75 | public function iChooseChannelAsAChannelFilter(ChannelInterface $channel): void |
||
79 | |||
80 | /** |
||
81 | * @When I filter |
||
82 | */ |
||
83 | public function iFilter(): void |
||
87 | |||
88 | /** |
||
89 | * @When I view the first shipment of the order :order |
||
90 | */ |
||
91 | public function iViewTheShipmentOfTheOrder(OrderInterface $order): void |
||
95 | |||
96 | /** |
||
97 | * @Then I should see( only) :count shipment(s) in the list |
||
98 | * @Then I should see a single shipment in the list |
||
99 | */ |
||
100 | public function iShouldSeeCountShipmentsInList(int $count = 1): void |
||
104 | |||
105 | /** |
||
106 | * @When I ship the shipment of order :order |
||
107 | */ |
||
108 | public function iShipShipmentOfOrder(OrderInterface $order): void |
||
112 | |||
113 | /** |
||
114 | * @When I ship the shipment of order :order with :trackingCode tracking code |
||
115 | */ |
||
116 | public function iShipTheShipmentOfOrderWithTrackingCode(OrderInterface $order, string $trackingCode): void |
||
124 | |||
125 | /** |
||
126 | * @Then I should be notified that the shipment has been successfully shipped |
||
127 | */ |
||
128 | public function iShouldBeNotifiedThatTheShipmentHasBeenSuccessfullyShipped(): void |
||
132 | |||
133 | /** |
||
134 | * @Then /^I should see the shipment of (order "[^"]+") as "([^"]+)"$/ |
||
135 | */ |
||
136 | public function iShouldSeeTheShipmentOfOrderAs(OrderInterface $order, string $shippingState): void |
||
146 | |||
147 | /** |
||
148 | * @Then /^I should see shipment for the ("[^"]+" order) as (\d+)(?:|st|nd|rd|th) in the list$/ |
||
149 | */ |
||
150 | public function iShouldSeeShipmentForTheOrderInTheList(OrderInterface $order, int $position): void |
||
162 | |||
163 | /** |
||
164 | * @Then I should see the shipment of order :order shipped at :dateTime |
||
165 | */ |
||
166 | public function iShouldSeeTheShippingDateAs(OrderInterface $order, string $dateTime): void |
||
174 | |||
175 | /** |
||
176 | * @Then the shipment of the :orderNumber order should be :shippingState for :customer |
||
177 | * @Then the shipment of the :orderNumber order should be :shippingState for :customer in :channel channel |
||
178 | */ |
||
179 | public function shipmentOfOrderShouldBe( |
||
207 | |||
208 | /** |
||
209 | * @Then I should see a shipment of order :order |
||
210 | */ |
||
211 | public function iShouldSeeShipmentWithOrderNumber(OrderInterface $order): void |
||
218 | |||
219 | /** |
||
220 | * @Then I should not see a shipment of order :order |
||
221 | */ |
||
222 | public function iShouldNotSeeShipmentWithOrderNumber(OrderInterface $order): void |
||
229 | |||
230 | /** |
||
231 | * @Then I should see :amount :product units in the list |
||
232 | */ |
||
233 | public function iShouldSeeUnitsInTheList(int $amount, ProductInterface $product): void |
||
256 | |||
257 | private function isShipmentForOrder(OrderInterface $order): bool |
||
265 | } |
||
266 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: