From 5eb4ec1f6fb2d265d85dd0cd7226074181544505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20J=C4=99drzejewski?= Date: Sat, 27 Apr 2013 12:33:10 +0200 Subject: [PATCH] Render all taxons, split behat into 3 profiles --- .travis.yml | 4 ++- behat.yml.dist | 14 +++++++-- .../WebBundle/Menu/FrontendMenuBuilder.php | 31 ++++++++++--------- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index d2ee6039be..e9fdd463b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,9 @@ before_script: - sleep 5 script: - - bin/behat --no-snippets --no-paths --verbose + - bin/behat --no-snippets --no-paths --verbose -p frontend + - bin/behat --no-snippets --no-paths --verbose -p backend +# - bin/behat --no-snippets --no-paths --verbose -p api notifications: email: "travis-ci@sylius.org" diff --git a/behat.yml.dist b/behat.yml.dist index 26f79c212c..3d37520d07 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -16,6 +16,14 @@ default: class: SyliusKernel mink_driver: true -no-js: - filters: - tags: "~@javascript" +frontend: + paths: + features: features/frontend + +backend: + paths: + features: features/backend + +api: + paths: + features: features/api diff --git a/src/Sylius/Bundle/WebBundle/Menu/FrontendMenuBuilder.php b/src/Sylius/Bundle/WebBundle/Menu/FrontendMenuBuilder.php index 538002473f..58d0c628b3 100644 --- a/src/Sylius/Bundle/WebBundle/Menu/FrontendMenuBuilder.php +++ b/src/Sylius/Bundle/WebBundle/Menu/FrontendMenuBuilder.php @@ -13,12 +13,13 @@ namespace Sylius\Bundle\WebBundle\Menu; use Knp\Menu\FactoryInterface; use Knp\Menu\ItemInterface; +use Sylius\Bundle\CartBundle\Provider\CartProviderInterface; +use Sylius\Bundle\MoneyBundle\Twig\SyliusMoneyExtension; use Sylius\Bundle\ResourceBundle\Model\RepositoryInterface; +use Sylius\Bundle\TaxonomiesBundle\Model\TaxonInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\SecurityContextInterface; use Symfony\Component\Translation\TranslatorInterface; -use Sylius\Bundle\CartBundle\Provider\CartProviderInterface; -use Sylius\Bundle\MoneyBundle\Twig\SyliusMoneyExtension; /** * Frontend menu builder. @@ -156,18 +157,25 @@ class FrontendMenuBuilder extends MenuBuilder foreach ($taxonomies as $taxonomy) { $child = $menu->addChild($taxonomy->getName(), $childOptions); - foreach ($taxonomy->getTaxons() as $taxon) { - $child->addChild($taxon->getName(), array( - 'route' => 'sylius_product_index_by_taxon', - 'routeParameters' => array('permalink' => $taxon->getPermalink()), - 'labelAttributes' => array('icon' => 'icon-angle-right') - )); - } + $this->createTaxonomiesMenuNode($child, $taxonomy->getRoot()); } return $menu; } + private function createTaxonomiesMenuNode(ItemInterface $menu, TaxonInterface $taxon) + { + foreach ($taxon->getChildren() as $child) { + $childMenu = $menu->addChild($child->getName(), array( + 'route' => 'sylius_product_index_by_taxon', + 'routeParameters' => array('permalink' => $child->getPermalink()), + 'labelAttributes' => array('icon' => 'icon-angle-right') + )); + + $this->createTaxonomiesMenuNode($childMenu, $child); + } + } + /** * Builds frontend social menu. * @@ -198,11 +206,6 @@ class FrontendMenuBuilder extends MenuBuilder 'linkAttributes' => array('title' => $this->translate('sylius.frontend.menu.social.facebook')), 'labelAttributes' => array('icon' => 'icon-facebook-sign icon-large', 'iconOnly' => true) )); - $menu->addChild('google', array( - 'uri' => '#', - 'linkAttributes' => array('title' => $this->translate('sylius.frontend.menu.social.google')), - 'labelAttributes' => array('icon' => 'icon-google-plus-sign icon-large', 'iconOnly' => true) - )); $menu->addChild('linkedin', array( 'uri' => 'http://www.linkedin.com/groups/Sylius-Community-4903257', 'linkAttributes' => array('title' => $this->translate('sylius.frontend.menu.social.linkedin')),