function it_should_correctly_match_the_same_elements_with_different_locale(VoterInterface $menuElementVoter, ItemInterface $item, LocaleManager $localeManager)
 {
     $localeManager->getLocale()->willReturn('pl');
     $menuElementVoter->matchItem($item)->willReturn(true);
     $item->getExtra('routes', array())->willReturn(array(0 => array('parameters' => array('locale' => 'en'))));
     $this->matchItem($item)->shouldReturn(false);
     $item->getExtra('routes', array())->willReturn(array(0 => array('parameters' => array('locale' => 'pl'))));
     $this->matchItem($item)->shouldReturn(true);
     $item->getExtra('routes', array())->willReturn(array(0 => array('parameters' => array('locale' => 'de'))));
     $this->matchItem($item)->shouldReturn(false);
 }
 /**
  * {@inheritdoc}
  */
 public function matchItem(ItemInterface $item)
 {
     $elementMatch = $this->menuElementVoter->matchItem($item);
     if (false === $elementMatch || null === $elementMatch) {
         return $elementMatch;
     }
     $currentLocale = $this->localeManager->getLocale();
     $routes = (array) $item->getExtra('routes', array());
     foreach ($routes as $testedRoute) {
         $routeParameters = $testedRoute['parameters'];
         if (!isset($routeParameters['locale'])) {
             continue;
         }
         return $routeParameters['locale'] === $currentLocale;
     }
     return $elementMatch;
 }