From 974898a8dc569d570a62b041cac61d1c93d70961 Mon Sep 17 00:00:00 2001 From: ultrono Date: Mon, 18 Jan 2021 11:34:16 +0000 Subject: [PATCH] Add a more sensible default config that does not string hyphens --- config/f9web-laravel-meta.php | 6 +++--- src/Meta.php | 2 +- tests/MetaTitleTagTest.php | 2 +- tests/TestCase.php | 9 +++++++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/config/f9web-laravel-meta.php b/config/f9web-laravel-meta.php index 051a7ee..541f240 100644 --- a/config/f9web-laravel-meta.php +++ b/config/f9web-laravel-meta.php @@ -85,15 +85,15 @@ | Title tag replacements |-------------------------------------------------------------------------- | - | Optionally replace specific title characters. By default a hyphen - | is replaced by a space + | Optionally replace specific title characters. By default, no characters + | are replaced. | */ 'meta-title-replacements' => [ 'enabled' => true, 'search' => [ - '-', + '', ], 'replace' => [ diff --git a/src/Meta.php b/src/Meta.php index ef51727..17132ad 100644 --- a/src/Meta.php +++ b/src/Meta.php @@ -40,7 +40,7 @@ class Meta implements Htmlable public static function setRawTags(array $tags = []): self { array_map( - function ($tag) { + static function ($tag) { self::setRawTag($tag); }, $tags diff --git a/tests/MetaTitleTagTest.php b/tests/MetaTitleTagTest.php index a4d4ddf..1890c83 100644 --- a/tests/MetaTitleTagTest.php +++ b/tests/MetaTitleTagTest.php @@ -92,7 +92,7 @@ public function it_renders_the_expected_title_when_hyphens_are_present() // given the title is not set and a default exists $this->app['config']->set( [ - 'f9web-laravel-meta.fallback-meta-title' => 'App-Name', + 'f9web-laravel-meta.fallback-meta-title' => 'App Name', 'f9web-laravel-meta.meta-title-append' => null, ] ); diff --git a/tests/TestCase.php b/tests/TestCase.php index 4ec510a..1d77234 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -32,6 +32,15 @@ public function tearDown(): void 'enabled' => true, 'method' => 'route', ], + 'meta-title-replacements' => [ + 'enabled' => true, + 'search' => [ + '-', + ], + 'replace' => [ + ' ', + ] + ], 'removable-uri-segments' => [ '/public', '/index.php',