From 45ccf22d0892321e1bda366d3e90ad00e1beb1d5 Mon Sep 17 00:00:00 2001 From: Chris Kankiewicz Date: Mon, 8 Aug 2022 10:13:46 -0700 Subject: [PATCH] Made Illuminate\Config\Repository macroable (#43598) --- src/Illuminate/Config/Repository.php | 3 +++ tests/Config/RepositoryTest.php | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/Illuminate/Config/Repository.php b/src/Illuminate/Config/Repository.php index 4a28b2ff3793..640d6731bc27 100644 --- a/src/Illuminate/Config/Repository.php +++ b/src/Illuminate/Config/Repository.php @@ -5,9 +5,12 @@ use ArrayAccess; use Illuminate\Contracts\Config\Repository as ConfigContract; use Illuminate\Support\Arr; +use Illuminate\Support\Traits\Macroable; class Repository implements ArrayAccess, ConfigContract { + use Macroable; + /** * All of the configuration items. * diff --git a/tests/Config/RepositoryTest.php b/tests/Config/RepositoryTest.php index d64bbb6063e2..5a46da60bb7a 100644 --- a/tests/Config/RepositoryTest.php +++ b/tests/Config/RepositoryTest.php @@ -217,4 +217,13 @@ public function testOffsetUnset() $this->assertArrayHasKey('associate', $this->repository->all()); $this->assertNull($this->repository->get('associate')); } + + public function testsItIsMacroable() + { + $this->repository->macro('foo', function () { + return 'macroable'; + }); + + $this->assertSame('macroable', $this->repository->foo()); + } }