-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Behat] Add state transitions to creating orders programmatically #5440
Conversation
GSadee
commented
Jul 6, 2016
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Related tickets | |
License | MIT |
@@ -239,14 +245,15 @@ public function theCustomerChoseShippingWithPayment( | |||
|
|||
$this->orderShipmentFactory->processOrderShipment($order); | |||
$order->getShipments()->first()->setMethod($shippingMethod); | |||
|
|||
$this->orderRecalculator->recalculate($order); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant
$order->addPayment($payment); | ||
|
||
$this->stateMachineFactory->get($order, OrderCheckoutTransitions::GRAPH)->apply(OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT); | ||
$this->stateMachineFactory->get($order, OrderCheckoutTransitions::GRAPH)->apply(OrderCheckoutTransitions::TRANSITION_COMPLETE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could extract this all transitions calls to private method? Would be much cleaner:
private function applyTransition(OrderInterface $order, $transition)
{
$this->stateMachineFactory->get($order, OrderCheckoutTransitions::GRAPH)->apply($transition);
}
wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a bad idea :)
54a2549
to
2444090
Compare
*[Behat] Add state transitions to creating orders programmatically |
2444090
to
0c08ccd
Compare
Thanks Grzesiu! |