Skip to content

Commit

Permalink
Locale banner test
Browse files Browse the repository at this point in the history
  • Loading branch information
afonic committed Feb 11, 2024
1 parent 202a508 commit 68dd8a0
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests/Feature/LocaleBannerTagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,35 @@ public function setUp(): void
/** @test */
public function the_tag_returns_the_entry_if_locale_exists()
{
$this->withFakeViews();

$this->viewShouldReturnRaw('layout', '{{ template_content }}');
$this->viewShouldReturnRaw('default', '{{ locale_banner }}{{ /locale_banner }}');

$this->createMultisiteEntries();

Facades\Stache::clear();

ray($this->tag->index());
$response = $this->withHeaders([
'Accept-Language' => 'fr_FR',
])->get('/');

$tag = $this->tag->index();

$this->assertIsArray($tag);
$this->assertArrayHasKey('entry', $tag);
$this->assertIsArray($tag['entry']);

$this->assertArrayHasKey('site', $tag);
$this->assertIsArray($tag['site']->toArray());

$this->assertArrayHasKey('title', $tag['entry']);
$this->assertArrayHasKey('url', $tag['entry']);

$this->assertInstanceOf(\Statamic\Fields\Value::class, $tag['entry']['url']);
$this->assertEquals('/fr', $tag['entry']['url']->raw());
$this->assertEquals('French', $tag['site']->name());

}

private function setTagParameters($parameters)
Expand Down

0 comments on commit 68dd8a0

Please sign in to comment.