Skip to content

Commit

Permalink
Made Illuminate\Config\Repository macroable
Browse files Browse the repository at this point in the history
  • Loading branch information
PHLAK committed Aug 8, 2022
1 parent b132134 commit cc4208d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Illuminate/Config/Repository.php
Expand Up @@ -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.
*
Expand Down
9 changes: 9 additions & 0 deletions tests/Config/RepositoryTest.php
Expand Up @@ -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());
}
}

0 comments on commit cc4208d

Please sign in to comment.