-
-
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] Fix user fields disappearing on validation fails #6926
Conversation
tuka217
commented
Nov 29, 2016
•
edited
Loading
edited
Q | A |
---|---|
Bug fix? | yes |
New feature? | no |
BC breaks? | yes |
Related tickets | fixes #6725 |
License | MIT |
8279b8d
to
a7e9a02
Compare
8766e8a
to
947c293
Compare
} | ||
|
||
/** | ||
* @Then I should not be able to specify it password |
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.
its
{ | ||
Assert::false( | ||
$this->createPage->hasPasswordField(), | ||
'There should not be password field, but it is.' |
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.
Please, nooooo, no no no, nope nope, this is the most annoying message while debugging :( :( :( 🌮
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 how looks proper message?
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.
The step does say what behaviour is expected and if it's failing, it says that expected behaviour didn't occur. No message is the best message 🌯 🎉
{ | ||
Assert::true( | ||
$this->createPage->isOpen(), | ||
'The customer creation page should be open, but it is not.' |
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.
Same here.
{ | ||
Assert::false( | ||
$this->createPage->hasCheckedCreateOption(), | ||
'The create account option should not be selected, but it is.' |
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.
Same here.
409fef9
to
bf6cf8a
Compare
And I do not specify any information | ||
And I try to add it | ||
Then I should still be on the customer creation page | ||
And I should be able to specify it password |
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 should be able to specify its password
Given I am logged in as an administrator | ||
|
||
@ui @javascript | ||
Scenario: Trying add new customer with an account without required information |
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.
Shouldn't be Trying to add...
?
Feature: Create account option availability | ||
In order to correctly administrate customers | ||
As an Administrator | ||
I want not see create account option if the customer account already exist |
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.
exists
} | ||
|
||
/** | ||
* @Given /^I should not be able to select create account 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.
Unneeded /^
and $/
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.
and @Then
} | ||
|
||
/** | ||
* @Given I do not choose create account 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.
@When
@@ -14,7 +14,7 @@ | |||
'containerSelector': '#sylius_calculator_container' | |||
}); | |||
|
|||
$('#sylius_customer_create_user').change(function(){ | |||
$('#sylius_customer_createUser').change(function(){ |
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.
Why changing it?
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.
Because we use camelCase to named field in FormType. So we have sylius_nameOfEntity_nameOfField. Before this field was in twig template and it had the id "sylius_customer_create_user".
|
||
return; | ||
} | ||
if(null === $form->get('createUser')->getViewData()) { |
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.
Missing space after if
.
$form->get('createUser')->willReturn($createUserCheckForm); | ||
$createUserCheckForm->getViewData()->willReturn(null); | ||
|
||
|
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.
Double blank line.
3728876
to
e3b0daf
Compare
@@ -9,7 +9,7 @@ | |||
* file that was distributed with this source code. | |||
*/ | |||
|
|||
namespace Sylius\Bundle\UserBundle\Form\EventSubscriber; | |||
namespace Sylius\Bundle\ApiBundle\Form\EventSubscriber; |
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.
Why you moved this to ApiBundle?
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 it truly a part of UserBundle? Before we use this subscriber for Core CustomerType. After this fix this type has new subscriber, but the old one is still needed in ApiBundle.
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.
And probably should be fixed for api, but I'm not sure that it should be done in this PR.
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.
Having two separate form types is the only valid solution, since we expect a different behavior on API and Web, so that's correct! 👍
…h account after fialed create acction [AdminBundle] Fix customer _form file
[AdminBundle] Fix Customer _form and app.js
e3b0daf
to
21cf071
Compare
@@ -19,6 +19,8 @@ sylius_api_customer_show: | |||
_controller: sylius.controller.customer:showAction | |||
_sylius: | |||
serialization_groups: [Detailed] | |||
form: | |||
type: Sylius\Bundle\ApiBundle\Form\Extension\ApiCustomerType |
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 dont need to configure form for show action
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.
Please fix it in a separate PR.
@@ -9,7 +9,7 @@ | |||
* file that was distributed with this source code. | |||
*/ | |||
|
|||
namespace Sylius\Bundle\UserBundle\Form\EventSubscriber; | |||
namespace Sylius\Bundle\ApiBundle\Form\EventSubscriber; |
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.
Having two separate form types is the only valid solution, since we expect a different behavior on API and Web, so that's correct! 👍
Great job Ania! 👍 |