77use Statamic \Facades \Config ;
88use Statamic \Facades \Entry ;
99use Statamic \Facades \Site ;
10- use Tests \TestCase ;
1110use Tests \ViewScenarios ;
1211
13- class MetaTagTest extends TestCase
12+ class MetaTagTest extends LocalizedTestCase
1413{
1514 use ViewScenarios;
1615
17- protected $ siteFixturePath = __DIR__ .'/../Fixtures/site-localized ' ;
18-
1916 protected function getEnvironmentSetUp ($ app )
2017 {
2118 parent ::getEnvironmentSetUp ($ app );
2219
2320 $ app ['config ' ]->set ('view.paths ' , [$ this ->viewsPath ()]);
24- $ app ['config ' ]->set ('statamic.editions.pro ' , true );
25- $ app ['config ' ]->set ('statamic.system.multisite ' , true );
2621 }
2722
2823 protected function tearDown (): void
@@ -48,7 +43,7 @@ public function it_generates_multisite_meta($viewType)
4843 $ expectedAlternateHreflangMeta = <<<'EOT'
4944<link rel="alternate" href="http://cool-runnings.com" hreflang="en-us" />
5045<link rel="alternate" href="http://cool-runnings.com/fr" hreflang="fr" />
51- <link rel="alternate" href="http://cool-runnings.com/ it" hreflang="it" />
46+ <link rel="alternate" href="http://corse-fantastiche. it" hreflang="it" />
5247<link rel="alternate" href="http://cool-runnings.com/en-gb" hreflang="en-gb" />
5348EOT;
5449
@@ -74,7 +69,7 @@ public function it_generates_multisite_meta_for_non_home_page_route($viewType)
7469 $ expectedAlternateHreflangMeta = <<<'EOT'
7570<link rel="alternate" href="http://cool-runnings.com/about" hreflang="en" />
7671<link rel="alternate" href="http://cool-runnings.com/fr/about" hreflang="fr" />
77- <link rel="alternate" href="http://cool-runnings.com/ it/about" hreflang="it" />
72+ <link rel="alternate" href="http://corse-fantastiche. it/about" hreflang="it" />
7873EOT;
7974
8075 $ content = $ this ->get ('/about ' )->content ();
@@ -104,24 +99,24 @@ public function it_generates_multisite_meta_for_canonical_url_and_alternate_loca
10499 $ this ->prepareViews ($ viewType );
105100
106101 $ expectedOgLocaleMeta = <<<'EOT'
107- <meta property="og:locale" content="it_IT " />
102+ <meta property="og:locale" content="fr_FR " />
108103<meta property="og:locale:alternate" content="en_US" />
109- <meta property="og:locale:alternate" content="fr_FR " />
104+ <meta property="og:locale:alternate" content="it_IT " />
110105EOT;
111106
112107 $ expectedAlternateHreflangMeta = <<<'EOT'
113- <link href="http://cool-runnings.com/it/about" rel="canonical" />
114- <link rel="alternate" href="http://cool-runnings.com/it/about" hreflang="it" />
115- <link rel="alternate" href="http://cool-runnings.com/about" hreflang="en" />
108+ <link href="http://cool-runnings.com/fr/about" rel="canonical" />
116109<link rel="alternate" href="http://cool-runnings.com/fr/about" hreflang="fr" />
110+ <link rel="alternate" href="http://cool-runnings.com/about" hreflang="en" />
111+ <link rel="alternate" href="http://corse-fantastiche.it/about" hreflang="it" />
117112EOT;
118113
119114 // Though hitting a route will automatically set the current site,
120115 // we want to test that the alternate locales are generated off
121116 // the entry's model, not from the current site in the cp.
122117 Site::setCurrent ('default ' );
123118
124- $ content = $ this ->get ('/it /about ' )->content ();
119+ $ content = $ this ->get ('/fr /about ' )->content ();
125120
126121 $ this ->assertStringContainsStringIgnoringLineEndings ("<h1> {$ viewType }</h1> " , $ content );
127122 $ this ->assertStringContainsStringIgnoringLineEndings ($ expectedOgLocaleMeta , $ content );
@@ -135,10 +130,10 @@ public function it_handles_duplicate_alternate_hreflangs($viewType)
135130 $ this ->prepareViews ($ viewType );
136131
137132 $ expectedAlternateHreflangMeta = <<<'EOT'
138- <link href="http://cool-runnings.com/it" rel="canonical" />
139- <link rel="alternate" href="http://cool-runnings.com/it" hreflang="it" />
140- <link rel="alternate" href="http://cool-runnings.com" hreflang="en-us" />
133+ <link href="http://cool-runnings.com/fr" rel="canonical" />
141134<link rel="alternate" href="http://cool-runnings.com/fr" hreflang="fr" />
135+ <link rel="alternate" href="http://cool-runnings.com" hreflang="en-us" />
136+ <link rel="alternate" href="http://corse-fantastiche.it" hreflang="it" />
142137<link rel="alternate" href="http://cool-runnings.com/en-gb" hreflang="en-gb" />
143138EOT;
144139
@@ -147,7 +142,7 @@ public function it_handles_duplicate_alternate_hreflangs($viewType)
147142 // the entry's model, not from the current site in the cp.
148143 Site::setCurrent ('default ' );
149144
150- $ content = $ this ->get ('/it ' )->content ();
145+ $ content = $ this ->get ('/fr ' )->content ();
151146
152147 $ this ->assertStringContainsStringIgnoringLineEndings ("<h1> {$ viewType }</h1> " , $ content );
153148 $ this ->assertStringContainsStringIgnoringLineEndings ($ expectedAlternateHreflangMeta , $ content );
@@ -164,7 +159,7 @@ public function it_handles_duplicate_current_hreflang($viewType)
164159<link rel="alternate" href="http://cool-runnings.com/en-gb" hreflang="en-gb" />
165160<link rel="alternate" href="http://cool-runnings.com" hreflang="en-us" />
166161<link rel="alternate" href="http://cool-runnings.com/fr" hreflang="fr" />
167- <link rel="alternate" href="http://cool-runnings.com/ it" hreflang="it" />
162+ <link rel="alternate" href="http://corse-fantastiche. it" hreflang="it" />
168163EOT;
169164
170165 // Though hitting a route will automatically set the current site,
@@ -208,7 +203,7 @@ public function it_doesnt_generate_multisite_meta_for_excluded_sites($viewType)
208203
209204 $ expectedAlternateHreflangMeta = <<<'EOT'
210205<link rel="alternate" href="http://cool-runnings.com/about" hreflang="en" />
211- <link rel="alternate" href="http://cool-runnings.com/ it/about" hreflang="it" />
206+ <link rel="alternate" href="http://corse-fantastiche. it/about" hreflang="it" />
212207EOT;
213208
214209 $ content = $ this ->get ('/about ' )->content ();
@@ -235,7 +230,7 @@ public function it_doesnt_generate_multisite_meta_for_unpublished_content($viewT
235230
236231 $ expectedAlternateHreflangMeta = <<<'EOT'
237232<link rel="alternate" href="http://cool-runnings.com/about" hreflang="en" />
238- <link rel="alternate" href="http://cool-runnings.com/ it/about" hreflang="it" />
233+ <link rel="alternate" href="http://corse-fantastiche. it/about" hreflang="it" />
239234EOT;
240235
241236 $ content = $ this ->get ('/about ' )->content ();
@@ -266,7 +261,7 @@ public function it_doesnt_generate_multisite_meta_for_scheduled_content($viewTyp
266261
267262 $ expectedAlternateHreflangMeta = <<<'EOT'
268263<link rel="alternate" href="http://cool-runnings.com/about" hreflang="en" />
269- <link rel="alternate" href="http://cool-runnings.com/ it/about" hreflang="it" />
264+ <link rel="alternate" href="http://corse-fantastiche. it/about" hreflang="it" />
270265EOT;
271266
272267 $ content = $ this ->get ('/about ' )->content ();
@@ -297,7 +292,7 @@ public function it_doesnt_generate_multisite_meta_for_expired_content($viewType)
297292
298293 $ expectedAlternateHreflangMeta = <<<'EOT'
299294<link rel="alternate" href="http://cool-runnings.com/about" hreflang="en" />
300- <link rel="alternate" href="http://cool-runnings.com/ it/about" hreflang="it" />
295+ <link rel="alternate" href="http://corse-fantastiche. it/about" hreflang="it" />
301296EOT;
302297
303298 $ content = $ this ->get ('/about ' )->content ();
0 commit comments