From 8b6e04983004c2388751ae47b94183c45bafb727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 24 May 2021 18:29:07 +0200 Subject: [PATCH] Make default & modifier setters chainable --- src/SEOManager.php | 2 ++ tests/Pest/ManagerTest.php | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/SEOManager.php b/src/SEOManager.php index 929289a..5c329ca 100644 --- a/src/SEOManager.php +++ b/src/SEOManager.php @@ -206,7 +206,9 @@ class SEOManager if (isset($arguments[0])) { $this->set($key, $arguments[0]); + } + if (isset($arguments[0]) || isset($arguments['default']) || isset($arguments['modifier']) || isset($arguments['modify'])) { return $this; } diff --git a/tests/Pest/ManagerTest.php b/tests/Pest/ManagerTest.php index 1773f76..8ce5154 100644 --- a/tests/Pest/ManagerTest.php +++ b/tests/Pest/ManagerTest.php @@ -78,3 +78,7 @@ test('thunks can be used as defaults', function () { expect(seo('title'))->toBe('bar'); }); + +test('setting the defaults returns the manager instance', function () { + expect(seo()->title(default: 'foo'))->toBeInstanceOf(SEOManager::class); +});