@@ 97-109 (lines=13) @@ | ||
94 | $this->assertSame('Spanish', Locale::getByLocale('es_US')->getNativeName()); |
|
95 | } |
|
96 | ||
97 | public function testGetBaseURLContainsDomainAndURLSegmentForNonDefaultLocale() |
|
98 | { |
|
99 | // es_ES has a domain but is not the default locale for that domain |
|
100 | $result = Locale::getByLocale('es_ES')->getBaseURL(); |
|
101 | $this->assertContains('fluent.es', $result, "Locale's domain is in the URL"); |
|
102 | $this->assertContains('/es/', $result, 'URL segment for non-default locale is in the URL'); |
|
103 | ||
104 | // Turning off domain mode removes domain but not prefix |
|
105 | FluentState::singleton()->setIsDomainMode(false); |
|
106 | $result = Locale::getByLocale('es_ES')->getBaseURL(); |
|
107 | $this->assertNotContains('fluent.es', $result, "Locale's domain is in the URL"); |
|
108 | $this->assertContains('/es/', $result, 'URL segment for non-default locale is in the URL'); |
|
109 | } |
|
110 | ||
111 | public function testGetBaseURLOnlyContainsDomainForDefaultLocale() |
|
112 | { |
|
@@ 111-123 (lines=13) @@ | ||
108 | $this->assertContains('/es/', $result, 'URL segment for non-default locale is in the URL'); |
|
109 | } |
|
110 | ||
111 | public function testGetBaseURLOnlyContainsDomainForDefaultLocale() |
|
112 | { |
|
113 | // es_US has a domain and is the default |
|
114 | $result = Locale::getByLocale('es_US')->getBaseURL(); |
|
115 | $this->assertContains('fluent.es', $result, "Locale's domain is in the URL"); |
|
116 | $this->assertNotContains('/es-usa/', $result, 'URL segment is not in the URL for default locales'); |
|
117 | ||
118 | // When domain mode is turned off, prefix is now necessary |
|
119 | FluentState::singleton()->setIsDomainMode(false); |
|
120 | $result = Locale::getByLocale('es_US')->getBaseURL(); |
|
121 | $this->assertNotContains('fluent.es', $result, "Domain not used"); |
|
122 | $this->assertContains('/es-usa/', $result, 'URL Segment necessary for non-global default'); |
|
123 | } |
|
124 | ||
125 | public function testGetSiblings() |
|
126 | { |