/**
  * @param string $language
  *
  * @dataProvider provideAliasIdAndLanguage
  */
 public function testGetAliasIdForLanguage($language)
 {
     $alias1 = Phake::mock('OpenOrchestra\\ModelInterface\\Model\\SiteAliasInterface');
     Phake::when($alias1)->getLanguage()->thenReturn('fr');
     $alias2 = Phake::mock('OpenOrchestra\\ModelInterface\\Model\\SiteAliasInterface');
     Phake::when($alias2)->getLanguage()->thenReturn('en');
     $this->site->addAlias($alias1);
     $this->site->addAlias($alias2);
     $aliases = $this->site->getAliases();
     $this->assertTrue($aliases->containsKey($this->site->getAliasIdForLanguage($language)));
     $this->assertSame($language, $aliases[$this->site->getAliasIdForLanguage($language)]->getLanguage());
 }
 /**
  * @param array         $sitesNames
  * @param array         $sitesLanguages
  * @param SiteInterface $site
  * @param array         $prefixes
  */
 protected function addSitesAliases(array $sitesNames, array $sitesLanguages, $site, array $prefixes = array())
 {
     $master = true;
     foreach ($sitesNames as $siteName) {
         foreach ($sitesLanguages as $siteLanguage) {
             $prefix = isset($prefixes[$siteLanguage]) ? $prefixes[$siteLanguage] : null;
             $site->addAlias($this->generateSiteAlias($siteName, $siteLanguage, $master, $prefix));
             $master = false;
         }
     }
 }