-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Admin] Editing countries #4442
Conversation
Arminek
commented
Mar 9, 2016
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Related tickets | #4374 |
License | MIT |
3d8c019
to
fda22c7
Compare
{ | ||
$rows = $this->tableManipulator->getRowsWithFields($this->getElement('table'), $parameters); | ||
|
||
if (!empty($rows)) { |
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.
return !empty($rows);
?
fda22c7
to
38097e5
Compare
@todo | ||
Scenario: Disabling country | ||
Given the store has "France" country enabled | ||
And I want to disable country |
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.
Wouldn't it be better with I want to edit country "France"
or something alike?
That way you'd have one @Given
method instead of 2 doing the exact same thing.
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.
👍
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 toggling is so specific function, that it is worth to mention the beginning state of entity. I vote for 2 different steps.
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 want to disable country
is a step that is more suitable for toggling on the index page.
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.
Anyway, I want to edit this country
7fe10f8
to
a44ea94
Compare
{ | ||
$this->sharedStorage->set('country', $country); | ||
$this->countryRepository->add($country); | ||
} |
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't we somehow merge this steps or extract common logic? They're pretty similar :D
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.
Most likely it would work as one step with 2 tags, cause transformer is taking care of the difference here.
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 was thinking about such a solution, sounds good for me 👍
a44ea94
to
d890dc5
Compare
e91b4ea
to
9881197
Compare
@@ -52,6 +72,30 @@ public function iWantToCreateNewCountry() | |||
} | |||
|
|||
/** | |||
* @Given /^(country "([^"]*)") should appear in the store$/ | |||
*/ | |||
public function countryWithNameShouldAppearInTheStore(CountryInterface $country) |
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.
Method name should reflect step definition -> countryShouldAppearInTheStore
7a38fb9
to
8d546fa
Compare
|
||
@ui | ||
Scenario: Enabling country | ||
Given the store operates in "France" but it is disabled |
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.
What about putting but it is disabled
in a new line? 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.
👍, could be applicated to any model implementing TogglableInterface
.
eb8df80
to
cbe64f7
Compare
…tion, add country transformer context, add managing countries setup context
df68883
to
2258eec
Compare
2258eec
to
5b2bb04
Compare
930aaf1
to
f9eeb15
Compare
*/ | ||
public function iShouldBeNotifiedAboutSuccessfulCreation() | ||
{ | ||
$doesSuccessMessageAppear = $this->notificationAccessor->hasSuccessMessage(); |
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 remove this variable, it does not add much readability, it is used only once and naming it properly seems like a challenge. Agree?
[Admin] Editing countries
Thanks Arek! Please apply my comments in one of your further PRs. 👍 |
$this->thisCountryShouldBeEnabled($country); | ||
} | ||
|
||
function it_throws_not_equal_exception_if_country_has_not_proper_status(IndexPageInterface $countryIndexPage, CountryInterface $country) |
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_equal_exception
-> invalid_argument_exception
} catch (\InvalidArgumentException $exception) { | ||
return false; | ||
} catch (ElementNotFoundException $exception) { | ||
return false; |
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.
Current logic is not totally correct, we shouldn't silence these exceptions. Example:
if (!$this->isCountryDisabled($country)) {
// here I assume that the country is enabled, but it doesn't have to be since there could be exception
}