-
-
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
Stateless cart provider #3637
Stateless cart provider #3637
Conversation
819a6b5
to
f0cc651
Compare
@@ -48,11 +48,11 @@ class CartProvider implements CartProviderInterface | |||
protected $cartFactory; | |||
|
|||
/** | |||
* Cart repository. | |||
* Cart Repository. |
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.
Quite obvious, don't you think?
$eventDispatcher->dispatch(SyliusCartEvents::CART_INITIALIZE, Argument::any())->shouldBeCalled(); | ||
$cartRepository->find()->shouldNotBeCalled(); | ||
|
||
$this->initialize_cart_should_be_called_on($eventDispatcher); |
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.
Spec's are not the classes, so it is not a good practice to remove duplications. I found it less readable with this private method. And instead of reading what it should do, I have to jump to private declaration. And it is used only twice. Remove this method.
e4bba40
to
20ee12c
Compare
20ee12c
to
43d9e0b
Compare
Ready. |
Feedback please, this is underpinning sorting out finances. |
Stateless cart provider
Services should be stateless. CartProvider holding cart was just premature optimisation and just wrong.