-
-
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
[Country] Adding a province to a country manually #6002
Conversation
tuka217
commented
Sep 7, 2016
•
edited
Loading
edited
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | yes |
Related tickets | - |
License | MIT |
5089a2a
to
1edb2f6
Compare
e1234b1
to
4d367a2
Compare
3a55532
to
ac986e0
Compare
/** | ||
* @Then the province in the shipping address should be :provinceName | ||
*/ | ||
public function hisProvinceInTheShippingAddressShouldBe($provinceName) |
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.
theProvinceInTheShippingAddressShouldBe
Assert::notNull($province,sprintf('Province with code "%s" not found.', $address->getProvinceCode())); | ||
|
||
if (null !== $provinceAbbreviation = $province->getAbbreviation()) { | ||
|
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 blank line, I think.
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 we always put blank line before return
?
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.
Add a blank line before return statements, unless the return is alone inside a statement-group (like an if statement);
Btw. we can remove this if
and the next return
statement by:
return $province->getAbbreviation() ?: $province->getName();
4f48377
to
c9a8b56
Compare
Scenario: Seeing a province manually defined in a order history | ||
When I view the summary of the order "#00000666" | ||
Then I should see "East of England" as province in the shipping address | ||
And I should see "East of England" ad province in the billing address |
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.
as province
c9a8b56
to
7bec5b8
Compare
And the store has "DHL" shipping method with "$20.00" fee within "EN" zone | ||
And the store has a product "Angel T-Shirt" priced at "$39.00" | ||
And I am a logged in customer | ||
And I placed an order "#00000666" |
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 don't have to be logged in customer, We can use step "And customer "x" placed 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.
But I want to see my order in the history.
And the store has a zone "English" with code "EN" | ||
And this zone has the "United Kingdom" country member | ||
And the store operates on a channel named "Web" | ||
And that channel allows to shop using the "GBP" currency |
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 needed.
Given the store ships to "United Kingdom" | ||
And the store has a zone "English" with code "EN" | ||
And this zone has the "United Kingdom" country member | ||
And the store operates on a channel named "Web" |
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.
Channel should be specified in the first step.
I want to be able to see province in the order history | ||
|
||
Background: | ||
Given the store ships to "United Kingdom" |
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 store operates in "United Kingdom"
|
||
@ui @javascript | ||
Scenario: Seeing manually defined province on order summary page | ||
Given I had product "PHP T-Shirt" in the cart |
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 added - IMO is more appropriate
{{ address.provinceCode|sylius_province_abbreviation }}<br/> | ||
{{ address|sylius_province_name }} | ||
{% if address|sylius_province_name is not null %} | ||
<br/> |
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 think the following will be more readable:
{% if address|sylius_province_name is not null %}
{{ address|sylius_province_name }}<br/>
{% endif %}
{{ address.provinceCode|sylius_province_abbreviation }}<br/> | ||
{{ address|sylius_province_name }} | ||
{% if address|sylius_province_name is not null %} | ||
<br/> |
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 as above.
} | ||
|
||
return $provinceCode; | ||
return 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.
if (null !== $address->getProvinceName()) {
return $address->getProvinceName();
}
if (null === $address->getProvinceCode()) {
return null;
}
$province = $this->provinceRepository->findOneBy(['code' => $address->getProvinceCode()]);
Assert::notNull($province,sprintf('Province with code "%s" not found.', $address->getProvinceCode()));
return $province->getName();
IMO looks more readable, WDYT?
} | ||
|
||
return $province; | ||
return 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.
Same as above.
* | ||
* @return string | ||
* @return string|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.
Should we return null
or empty string, 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 big difference, because in twig we do not render this field if it is null. But using string only will be more coherent.
1644fa2
to
c6f7c48
Compare
I want to be able to see specific customer's page with provinces in the addresses | ||
|
||
Background: | ||
Given I am logged in as an administrator |
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.
Since we have only one scenario here the background in not necessary.
return $this->hasElement('login_button'); | ||
}); | ||
} | ||
|
||
private function waitForLoginAction() |
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.
Can be replaced with waitForElement
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.
Cannot. It waits until an element disappear.
@@ -1,4 +1,4 @@ | |||
<address> | |||
\<address> |
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.
Should be reverted.
* | ||
* @return string | ||
* @return string|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.
It does not return null
anymore.
* | ||
* @return string | ||
* @return string|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.
It does not return null
anymore.
@tuka217 please rebase. Last comments can be applied in a separate PR. |
[AddresingBundle] Fix BulidAdddresFormSubscriberSpec
[Addressing] Add ProvinceNameProvider
be195ed
to
a8f2e19
Compare
a8f2e19
to
9d2915e
Compare
Nice work Ania! 👍 |