/**
  * Test lookup of a locale from url
  */
 function testURLtoLocale()
 {
     foreach (TranslatableDomains::$domain_locale_map as $TLD => $domainLocale) {
         $www_domain = "http://www.{$TLD}";
         $no_www_domain = "http://{$TLD}";
         $domain_with_sub = "http://sub.{$TLD}";
         $domain_with_double_sub = "http://sub.sub.{$TLD}";
         $www_domain_w_port = "http://www.{$TLD}:8888";
         $no_www_domain_w_port = "http://{$TLD}:8888";
         $domain_with_sub_w_port = "http://sub.{$TLD}:8888";
         $domain_with_double_sub_w_port = "http://sub.sub.{$TLD}:8888";
         $this->assertEquals(TranslatableDomains::getLocaleFromURL($www_domain), $domainLocale, "Failed Testing domain with www, using {$www_domain} => {$domainLocale}");
         $this->assertEquals(TranslatableDomains::getLocaleFromURL($no_www_domain), $domainLocale, "Failed Testing domain with no www, using {$no_www_domain} => {$domainLocale}");
         $this->assertEquals(TranslatableDomains::getLocaleFromURL($domain_with_sub), $domainLocale, "Failed Testing domain with subdomain, using {$domain_with_sub} => {$domainLocale}");
         $this->assertEquals(TranslatableDomains::getLocaleFromURL($domain_with_double_sub), $domainLocale, "Failed Testing domain with double subdomain, using {$domain_with_double_sub} => {$domainLocale}");
         $this->assertEquals(TranslatableDomains::getLocaleFromURL($www_domain_w_port), $domainLocale, "Failed Testing domain with www and port, using {$www_domain_w_port} => {$domainLocale}");
         $this->assertEquals(TranslatableDomains::getLocaleFromURL($no_www_domain_w_port), $domainLocale, "Failed Testing domain with no www and port, using {$no_www_domain_w_port} => {$domainLocale}");
         $this->assertEquals(TranslatableDomains::getLocaleFromURL($domain_with_sub_w_port), $domainLocale, "Failed Testing domain with subdomain and port, using {$domain_with_sub_w_port} => {$domainLocale}");
         $this->assertEquals(TranslatableDomains::getLocaleFromURL($domain_with_double_sub_w_port), $domainLocale, "Failed Testing domain with double subdomain and port, using {$domain_with_double_sub_w_port} => {$domainLocale}");
     }
     $this->assertEquals(TranslatableDomains::getLocaleFromURL("http://subsite.mysite.xyz"), 'en_US', 'getLocaleFromURL should return default locale if no locales are matched.');
     $this->assertNull(TranslatableDomains::getTLD("http://subsite.mysite.xyz"), "Failed Testing domain, domain should not be registered with domain_locale_map");
 }