-
-
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
[Admin][Payment] Sorting payment metods by position #6745
[Admin][Payment] Sorting payment metods by position #6745
Conversation
tuka217
commented
Nov 16, 2016
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | yes |
Related tickets | - |
License | MIT |
8a1ad30
to
464b9d4
Compare
|
||
@ui | ||
Scenario: Payment methods are sorted by position in ascending order by default | ||
When I am browsing payment methods |
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.
When I browse payment methods
or
Given I am browsing payment methods
in my opinion
|
||
@ui | ||
Scenario: Payment method added at no position is added as the last one | ||
Given the store also allows paying with "Credit Card" |
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.
I guess that also
is not needed
* @Given the store allows paying :paymentMethodName | ||
* @Given the store allows paying with :paymentMethodName | ||
* @Given the store (also) allows paying :paymentMethodName | ||
* @Given the store (also) allows paying with :paymentMethodName |
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.
You could merge this line with above by adding (with)
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.
Is the variation without "with" correct?
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.
Probably not, but it is old step. I can fix it here if it won't cause to many problems.
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.
@pamil While it doesn't sound right for credit card or paypal; for offline (which we use quite a lot) using with
would be silly
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.
Yups
@@ -16,6 +16,8 @@ | |||
use Sylius\Component\Payment\Model\PaymentMethodInterface; | |||
|
|||
/** | |||
* @mixin PaymentMethod |
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.
We should not add @mixin
docbloc
464b9d4
to
cd078dc
Compare
->add('position', IntegerType::class, [ | ||
'required' => false, | ||
'label' => 'sylius.form.shipping_method.position', | ||
]) | ||
->add('enabled', 'checkbox', [ |
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.
Imo checkbox
should be changed into CheckboxType::class
.
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 part of this PR, I've already done that in #6738.
And I am logged in as an administrator | ||
|
||
@ui | ||
Scenario: Payment methods are sorted by position in ascending order by default |
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.
Actually it does not assert that methods are sorted by position, because they can be as well sorted by id and this scenario would pass. We need to shuffle the order of creating payment methods.
* @Given the store allows paying :paymentMethodName | ||
* @Given the store allows paying with :paymentMethodName | ||
* @Given the store (also) allows paying :paymentMethodName | ||
* @Given the store (also) allows paying with :paymentMethodName |
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.
Is the variation without "with" correct?
->add('position', IntegerType::class, [ | ||
'required' => false, | ||
'label' => 'sylius.form.shipping_method.position', | ||
]) | ||
->add('enabled', 'checkbox', [ |
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 part of this PR, I've already done that in #6738.
|
||
function it_adds_add_code_event_subscriber(FormBuilder $builder) | ||
{ | ||
$builder->add(Argument::any(), Argument::cetera())->willReturn($builder); |
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.
It does not check anything, deleting the whole spec would be the better option 🗡
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.
💯 👍 for deleting
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.
If you say, that I can kill it then I will 🔫
d1f0a04
to
248d3c4
Compare
); | ||
} | ||
|
||
|
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 blank line.
@@ -83,20 +83,20 @@ public function __construct( | |||
} | |||
|
|||
/** | |||
* @Given the store allows paying :paymentMethodName | |||
* @Given the store allows paying with :paymentMethodName | |||
* @Given the store (also) allows paying (with) :paymentMethodName |
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.
After this change few steps could be broken. It is because also
keyword is optional but spaces around it are not. So only two valid sentences are store (two spaces here) allows
and store also allows
, but store allows
will be broken. (same for with
)
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.
Or I can be wrong and it will work. Nvm 💨
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.
If I am right, when the definition of step in docblock is not a regexp, behat is quite clever and interprets this correctly.
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.
My bad! Sorry ;)
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.
That's not true, Turnip will allow for the following patterns:
store allows
store also allows
Unfortunately, it will also allow for:
store allows
storeallows
storealso allows
store alsoallows
storealsoallows
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.
So meaningful regexp :D
Nevertheless, at the end we should have store (also )allows
I knew, there were a reason for this change 🎱
99d189b
to
0e022c6
Compare
…r implementation [Behat] Add scenario about viewing sorted payment method during checkout and it's implementation
[AdminBundle] Add sorting by position, allow admin to declare payment method position
0e022c6
to
a067654
Compare
Thank you Ania, nice work! :) |
…sition [Admin][Payment] Sorting payment metods by position
…sition [Admin][Payment] Sorting payment metods by position