Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperTey committed Nov 18, 2024
1 parent c4a011f commit d9e812b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
15 changes: 0 additions & 15 deletions src/Support/AutoloadManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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);
}

Expand Down
9 changes: 0 additions & 9 deletions tests/Command/OptimizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down
5 changes: 1 addition & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit d9e812b

Please sign in to comment.