From d9e812baf1007b56debd435eb6fbaa35ed44a3e8 Mon Sep 17 00:00:00 2001 From: Jasper Tey Date: Sun, 17 Nov 2024 21:14:19 -0500 Subject: [PATCH] Cleanup --- src/Support/AutoloadManager.php | 15 --------------- tests/Command/OptimizeTest.php | 9 --------- tests/TestCase.php | 5 +---- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/Support/AutoloadManager.php b/src/Support/AutoloadManager.php index 58ec892..90bf8cb 100644 --- a/src/Support/AutoloadManager.php +++ b/src/Support/AutoloadManager.php @@ -49,8 +49,6 @@ class AutoloadManager protected bool $ran = false; - protected static ?Closure $registeringProviderCallback = null; - public function __construct(protected ?Container $container = null) { $this->container = $container ?? Container::getInstance(); @@ -133,11 +131,6 @@ protected function getCustomLayerPaths(): array ])->map(fn ($path) => Path::normalize($this->app->basePath($path)))->toArray(); } - public static function registeringProvider(Closure $callback) - { - static::$registeringProviderCallback = $callback; - } - protected function handleProviders() { $providers = DomainCache::has('domain-providers') @@ -166,19 +159,11 @@ protected function handleCommands() public function run() { - // if ($this->hasRun()) { - // return $this; - // } - if (! $this->isBooted()) { $this->boot(); } foreach (static::$registeredProviders as $provider) { - if (static::$registeringProviderCallback) { - call_user_func(static::$registeringProviderCallback, $provider); - } - $this->app->register($provider); } diff --git a/tests/Command/OptimizeTest.php b/tests/Command/OptimizeTest.php index 4f06700..f2db8a4 100644 --- a/tests/Command/OptimizeTest.php +++ b/tests/Command/OptimizeTest.php @@ -19,7 +19,6 @@ file_put_contents(base_path('composer.json'), $this->originalComposerContents); - config()->set('data.structure_caching.enabled', false); $this->artisan('optimize:clear')->assertSuccessful()->execute(); }); @@ -48,8 +47,6 @@ }); it('can clear the cache', function () { - config()->set('data.structure_caching.enabled', false); - $this->artisan('ddd:optimize')->assertSuccessful()->execute(); expect(DomainCache::get('domain-providers'))->not->toBeNull(); @@ -67,8 +64,6 @@ }); it('will not be cleared by laravel cache clearing', function () { - config()->set('data.structure_caching.enabled', false); - expect(DomainCache::get('domain-providers'))->toBeNull(); expect(DomainCache::get('domain-commands'))->toBeNull(); expect(DomainCache::get('domain-migration-paths'))->toBeNull(); @@ -96,8 +91,6 @@ describe('laravel optimize', function () { test('optimize will include ddd:optimize', function () { - config()->set('data.structure_caching.enabled', false); - expect(DomainCache::get('domain-providers'))->toBeNull(); expect(DomainCache::get('domain-commands'))->toBeNull(); expect(DomainCache::get('domain-migration-paths'))->toBeNull(); @@ -112,8 +105,6 @@ }); test('optimize:clear will clear ddd cache', function () { - config()->set('data.structure_caching.enabled', false); - $this->artisan('ddd:optimize')->assertSuccessful()->execute(); expect(DomainCache::get('domain-providers'))->not->toBeNull(); diff --git a/tests/TestCase.php b/tests/TestCase.php index ce3a5d4..a7ba0a9 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -35,10 +35,7 @@ protected function setUp(): void config()->set('data.structure_caching.enabled', false); - Artisan::command('data:cache-structures', function () { - // do nothing - - }); + Artisan::command('data:cache-structures', function () {}); }); $this->afterApplicationRefreshed(function () {