From 17c331399095971f34123cb56157fdde6bf0fd3a Mon Sep 17 00:00:00 2001 From: Arminek Date: Tue, 26 Apr 2016 12:04:49 +0200 Subject: [PATCH] Review fixes --- etc/behat/services/contexts/ui.xml | 17 ++++++++-------- .../managing_taxons/adding_taxon.feature | 5 ++--- .../managing_taxons/browsing_taxon.feature | 3 +-- .../managing_taxons/deleting_taxon.feature | 5 ++--- .../managing_taxons/editing_taxon.feature | 3 +-- .../Behat/Context/Setup/TaxonomyContext.php | 1 + .../Ui/Admin/ManagingTaxonsContext.php | 20 +++++++++---------- .../Behat/Page/Admin/Taxon/CreatePage.php | 2 ++ .../Resources/config/routing/taxon.yml | 4 +++- .../views/Taxon/Macro/tree.html.twig | 3 --- .../Resources/views/Taxon/create.html.twig | 2 +- .../Resources/translations/messages.en.yml | 1 - 12 files changed, 31 insertions(+), 35 deletions(-) diff --git a/etc/behat/services/contexts/ui.xml b/etc/behat/services/contexts/ui.xml index 6ac32a5a90..fa3a20afb5 100644 --- a/etc/behat/services/contexts/ui.xml +++ b/etc/behat/services/contexts/ui.xml @@ -23,9 +23,8 @@ Sylius\Behat\Context\Ui\Admin\ManagingProductOptionsContext Sylius\Behat\Context\Ui\Admin\ManagingPromotionsContext Sylius\Behat\Context\Ui\Admin\ManagingShippingMethodsContext - Sylius\Behat\Context\Ui\Admin\ManagingTaxonsContext - Sylius\Behat\Context\Ui\Admin\ManagingTaxCategoryContext Sylius\Behat\Context\Ui\Admin\ManagingTaxCategoriesContext + Sylius\Behat\Context\Ui\Admin\ManagingTaxonsContext Sylius\Behat\Context\Ui\Admin\ManagingTaxRateContext Sylius\Behat\Context\Ui\Admin\ManagingZonesContext @@ -130,18 +129,18 @@ - - - + + + + - - - - + + + diff --git a/features/taxonomy/managing_taxons/adding_taxon.feature b/features/taxonomy/managing_taxons/adding_taxon.feature index 4a3dfa347f..f9b65b8621 100644 --- a/features/taxonomy/managing_taxons/adding_taxon.feature +++ b/features/taxonomy/managing_taxons/adding_taxon.feature @@ -5,8 +5,7 @@ Feature: Adding a new taxon I want to add a new taxon to the registry Background: - Given the store operates on a single channel in "France" - And I am logged in as an administrator + Given I am logged in as an administrator @ui Scenario: Adding a new taxon @@ -30,7 +29,7 @@ Feature: Adding a new taxon @ui Scenario: Adding a new taxon with parent taxon - Given the store classifies its products as "Category" + Given the store has "Category" taxonomy And I want to create a new taxon When I specify its code as "stickers" And I name it "Stickers" in "English (United States)" diff --git a/features/taxonomy/managing_taxons/browsing_taxon.feature b/features/taxonomy/managing_taxons/browsing_taxon.feature index 0258cb7d80..84104fbfd6 100644 --- a/features/taxonomy/managing_taxons/browsing_taxon.feature +++ b/features/taxonomy/managing_taxons/browsing_taxon.feature @@ -5,8 +5,7 @@ Feature: Browsing taxons I want to browse taxons Background: - Given the store operates on a single channel in "France" - And the store classifies its products as "T-Shirts" and "Accessories" + Given the store classifies its products as "T-Shirts" and "Accessories" And I am logged in as an administrator @ui diff --git a/features/taxonomy/managing_taxons/deleting_taxon.feature b/features/taxonomy/managing_taxons/deleting_taxon.feature index a364f97a1b..2957dc466c 100644 --- a/features/taxonomy/managing_taxons/deleting_taxon.feature +++ b/features/taxonomy/managing_taxons/deleting_taxon.feature @@ -5,12 +5,11 @@ Feature: Deleting a taxon I want to be able to delete a taxon Background: - Given the store operates on a single channel in "France" - And the store classifies its products as "T-Shirts" - And I am logged in as an administrator + Given I am logged in as an administrator @ui Scenario: Deleted taxon should disappear from the registry + Given the store classifies its products as "T-Shirts" When I delete taxon named "T-Shirts" Then I should be notified that it has been successfully deleted And the taxon named "T-Shirts" should no longer exist in the registry diff --git a/features/taxonomy/managing_taxons/editing_taxon.feature b/features/taxonomy/managing_taxons/editing_taxon.feature index 46f82035b5..c047749792 100644 --- a/features/taxonomy/managing_taxons/editing_taxon.feature +++ b/features/taxonomy/managing_taxons/editing_taxon.feature @@ -5,8 +5,7 @@ Feature: Editing a taxon I want to be able to edit a taxon Background: - Given the store operates on a single channel in "France" - And the store classifies its products as "T-Shirts" and "Accessories" + Given the store classifies its products as "T-Shirts" and "Accessories" And I am logged in as an administrator @ui diff --git a/src/Sylius/Behat/Context/Setup/TaxonomyContext.php b/src/Sylius/Behat/Context/Setup/TaxonomyContext.php index e70f7f64ff..ff6cb1d0e1 100644 --- a/src/Sylius/Behat/Context/Setup/TaxonomyContext.php +++ b/src/Sylius/Behat/Context/Setup/TaxonomyContext.php @@ -54,6 +54,7 @@ final class TaxonomyContext implements Context } /** + * @Given the store has :firstTaxonName taxonomy * @Given the store classifies its products as :firstTaxonName * @Given the store classifies its products as :firstTaxonName and :secondTaxonName * @Given the store classifies its products as :firstTaxonName, :secondTaxonName and :thirdTaxonName diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingTaxonsContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingTaxonsContext.php index c793ba99ff..852ddfd8af 100644 --- a/src/Sylius/Behat/Context/Ui/Admin/ManagingTaxonsContext.php +++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingTaxonsContext.php @@ -207,7 +207,7 @@ final class ManagingTaxonsContext implements Context /** * @Then I should be notified that it has been successfully edited */ - public function iShouldBeNotifiedAboutSuccessfulEdition() + public function iShouldBeNotifiedThatItHasBeenSuccessfullyEdited() { $this->notificationChecker->checkEditionNotification(self::RESOURCE_NAME); } @@ -228,7 +228,7 @@ final class ManagingTaxonsContext implements Context $this->updatePage->open(['id' => $taxon->getId()]); Assert::true( $this->updatePage->hasResourceValues(['code' => $taxon->getCode()]), - sprintf('Taxon %s should be in the registry', $taxon->getName()) + sprintf('Taxon %s should be in the registry.', $taxon->getName()) ); } @@ -239,18 +239,18 @@ final class ManagingTaxonsContext implements Context { Assert::true( $this->updatePage->hasResourceValues([$element => $value]), - sprintf('Taxon with %s should have %s value', $element, $value) + sprintf('Taxon with %s should have %s value.', $element, $value) ); } /** * @Then the code field should be disabled */ - public function theCodeFiledShouldBeDisabled() + public function theCodeFieldShouldBeDisabled() { Assert::true( $this->updatePage->isCodeDisabled(), - 'Code field should be disabled but it is not' + 'Code field should be disabled but it is not.' ); } @@ -261,7 +261,7 @@ final class ManagingTaxonsContext implements Context { Assert::true( $this->updatePage->hasResourceValues(['parent' => $taxon->getId()]), - sprintf('Current taxon should have %s parent taxon', $taxon->getName()) + sprintf('Current taxon should have %s parent taxon.', $taxon->getName()) ); } @@ -311,21 +311,21 @@ final class ManagingTaxonsContext implements Context Assert::eq( 0, $this->createPage->countTaxonsByName($name), - sprintf('Taxon %s should not exist', $name) + sprintf('Taxon %s should not exist.', $name) ); } /** * @Then /^I should see (\d+) taxons on the list$/ */ - public function iShouldSeeZonesInTheList($number) + public function iShouldSeeTaxonsInTheList($number) { $taxonsOnPage = $this->createPage->countTaxons(); Assert::eq( $number, $taxonsOnPage, - sprintf('On list should be %d taxons but get %d', $number, $taxonsOnPage) + sprintf('On list should be %d taxons but get %d.', $number, $taxonsOnPage) ); } @@ -337,7 +337,7 @@ final class ManagingTaxonsContext implements Context Assert::eq( 1, $this->createPage->countTaxonsByName($name), - sprintf('Taxon %s does not exist', $name) + sprintf('Taxon %s does not exist or multiple taxons with this name exist.', $name) ); } } diff --git a/src/Sylius/Behat/Page/Admin/Taxon/CreatePage.php b/src/Sylius/Behat/Page/Admin/Taxon/CreatePage.php index 85d63a5326..0207672201 100644 --- a/src/Sylius/Behat/Page/Admin/Taxon/CreatePage.php +++ b/src/Sylius/Behat/Page/Admin/Taxon/CreatePage.php @@ -70,6 +70,8 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface break; } } + + throw new ElementNotFoundException($this->getDriver(), 'Delete button'); } /** diff --git a/src/Sylius/Bundle/AdminBundle/Resources/config/routing/taxon.yml b/src/Sylius/Bundle/AdminBundle/Resources/config/routing/taxon.yml index 380a891382..081836b164 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/config/routing/taxon.yml +++ b/src/Sylius/Bundle/AdminBundle/Resources/config/routing/taxon.yml @@ -20,7 +20,6 @@ sylius_admin_taxon_index: _controller: sylius.controller.taxon:indexAction _sylius: template: SyliusAdminBundle:Taxon:index.html.twig - section: admin repository: method: findRootNodes host: "localhost" @@ -33,6 +32,9 @@ sylius_admin_taxon_create: _sylius: template: SyliusAdminBundle:Taxon:create.html.twig section: admin + redirect: + route: sylius_admin_taxon_update + parameters: { id: resource.id } vars: templates: form: SyliusAdminBundle:Taxon:_form.html.twig diff --git a/src/Sylius/Bundle/AdminBundle/Resources/views/Taxon/Macro/tree.html.twig b/src/Sylius/Bundle/AdminBundle/Resources/views/Taxon/Macro/tree.html.twig index 2f951f33fa..7de8ae5145 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/views/Taxon/Macro/tree.html.twig +++ b/src/Sylius/Bundle/AdminBundle/Resources/views/Taxon/Macro/tree.html.twig @@ -13,9 +13,6 @@
{{ taxon.name }}
{{ buttons.delete(path('sylius_admin_taxon_delete', { 'id': taxon.id }), 'sylius.ui.delete'|trans) }} {{ buttons.edit(path('sylius_admin_taxon_update', { 'id': taxon.id })) }} - {% if not taxon.description %} -
{{ taxon.description }}
- {% endif %}
{{ _self.renderLeaf(taxon.children) }}
diff --git a/src/Sylius/Bundle/AdminBundle/Resources/views/Taxon/create.html.twig b/src/Sylius/Bundle/AdminBundle/Resources/views/Taxon/create.html.twig index e7beaeb619..df749c8b3c 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/views/Taxon/create.html.twig +++ b/src/Sylius/Bundle/AdminBundle/Resources/views/Taxon/create.html.twig @@ -9,4 +9,4 @@ {{ parent() }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/Sylius/Bundle/UiBundle/Resources/translations/messages.en.yml b/src/Sylius/Bundle/UiBundle/Resources/translations/messages.en.yml index 7d572ffd91..91707d51a7 100644 --- a/src/Sylius/Bundle/UiBundle/Resources/translations/messages.en.yml +++ b/src/Sylius/Bundle/UiBundle/Resources/translations/messages.en.yml @@ -59,7 +59,6 @@ sylius: manage_product_option: Manage product option manage_shipping_destinations: Manage shipping destinations manage_taxons: Manage taxons of your products - manage_taxation_of_your_products: Manage taxation of your products manage_shipping_methods_for_your_store: Manage shipping methods for your store manage_taxation_of_your_products: Manage taxation of your products new: New