Skip to content
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] Editing countries #4442

Merged
merged 5 commits into from
Mar 22, 2016
Merged

Conversation

Arminek
Copy link
Contributor

@Arminek Arminek commented Mar 9, 2016

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Related tickets #4374
License MIT

@Arminek Arminek force-pushed the editing-countries branch 2 times, most recently from 3d8c019 to fda22c7 Compare March 9, 2016 14:10
{
$rows = $this->tableManipulator->getRowsWithFields($this->getElement('table'), $parameters);

if (!empty($rows)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return !empty($rows); ?

@michalmarcinkowski michalmarcinkowski added this to the v0.18.0 milestone Mar 11, 2016
@michalmarcinkowski michalmarcinkowski added the UX Issues and PRs aimed at improving User eXperience. label Mar 11, 2016
@todo
Scenario: Disabling country
Given the store has "France" country enabled
And I want to disable country
Copy link
Contributor

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Contributor

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

@Arminek Arminek force-pushed the editing-countries branch 3 times, most recently from 7fe10f8 to a44ea94 Compare March 13, 2016 17:50
@Arminek Arminek changed the title [Admin] Editing countries [WIP][Admin] Editing countries Mar 13, 2016
{
$this->sharedStorage->set('country', $country);
$this->countryRepository->add($country);
}
Copy link
Member

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

Copy link
Contributor

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.

Copy link
Member

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 👍

@Arminek Arminek changed the title [WIP][Admin] Editing countries [Admin] Editing countries Mar 18, 2016
@@ -52,6 +72,30 @@ public function iWantToCreateNewCountry()
}

/**
* @Given /^(country "([^"]*)") should appear in the store$/
*/
public function countryWithNameShouldAppearInTheStore(CountryInterface $country)
Copy link
Member

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

@Arminek Arminek force-pushed the editing-countries branch 2 times, most recently from 7a38fb9 to 8d546fa Compare March 21, 2016 10:49

@ui
Scenario: Enabling country
Given the store operates in "France" but it is disabled
Copy link
Member

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?

Copy link
Contributor

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.

@pjedrzejewski pjedrzejewski added Admin AdminBundle related issues and PRs. and removed UX Issues and PRs aimed at improving User eXperience. labels Mar 21, 2016
@Arminek Arminek force-pushed the editing-countries branch 2 times, most recently from eb8df80 to cbe64f7 Compare March 21, 2016 13:56
@Arminek Arminek force-pushed the editing-countries branch 2 times, most recently from df68883 to 2258eec Compare March 21, 2016 15:08
*/
public function iShouldBeNotifiedAboutSuccessfulCreation()
{
$doesSuccessMessageAppear = $this->notificationAccessor->hasSuccessMessage();
Copy link
Member

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?

pjedrzejewski pushed a commit that referenced this pull request Mar 22, 2016
@pjedrzejewski pjedrzejewski merged commit d84e97d into Sylius:master Mar 22, 2016
@pjedrzejewski
Copy link
Member

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)
Copy link
Member

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;
Copy link
Contributor

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin AdminBundle related issues and PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants