Skip to content

Commit

Permalink
Fixes tests and fixes base configuration loading
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Apr 24, 2024
1 parent a17c1e2 commit 95fd727
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 30 deletions.
22 changes: 22 additions & 0 deletions src/Bootstrap/BaseLoadConfiguration.php
Expand Up @@ -13,6 +13,7 @@

namespace LaravelZero\Framework\Bootstrap;

use ReflectionClass;
use Illuminate\Contracts\Foundation\Application as ApplicationContract;
use Illuminate\Foundation\Bootstrap\LoadConfiguration;
use Symfony\Component\Finder\Finder;
Expand Down Expand Up @@ -48,4 +49,25 @@ protected function getConfigurationFiles(ApplicationContract $app): array

return $files;
}

/**
* Get the base configuration files.
*
* @return array
*/
protected function getBaseConfiguration()
{
$config = [];

$reflector = new ReflectionClass($this);
$declaringClass = $reflector->getParentClass();
$dir = dirname($declaringClass->getFilename());

foreach (Finder::create()->files()->name('*.php')->in($dir.'/../../../../config') as $file) {
$config[basename($file->getRelativePathname(), '.php')] = require ($file->getPath() . '/' . $file->getFilename());
}

return $config;
}
}

2 changes: 1 addition & 1 deletion tests/Components/HttpComponentTest.php
Expand Up @@ -9,7 +9,7 @@
it('installs the required packages', function () {
$composerMock = $this->createMock(ComposerContract::class);

$composerMock->expects($this->exactly(2))
$composerMock->expects($this->exactly(1))
->method('require');

$this->app->instance(ComposerContract::class, $composerMock);
Expand Down
2 changes: 1 addition & 1 deletion tests/Components/LogInstallTest.php
Expand Up @@ -15,7 +15,7 @@

$composerMock->expects($this->once())
->method('require')
->with('illuminate/log "^10.0"');
->with('illuminate/log "^11.5"');

$this->app->instance(ComposerContract::class, $composerMock);

Expand Down
25 changes: 0 additions & 25 deletions tests/Components/LogoProviderTest.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/Components/MenuComponentTest.php
Expand Up @@ -10,7 +10,7 @@

$composerMock->expects($this->once())
->method('require')
->with('nunomaduro/laravel-console-menu "^3.4"');
->with('nunomaduro/laravel-console-menu "^3.5"');

$this->app->instance(ComposerContract::class, $composerMock);

Expand Down
2 changes: 1 addition & 1 deletion tests/Components/RedisInstallTest.php
Expand Up @@ -10,7 +10,7 @@

$composerMock->expects($this->once())
->method('require')
->with('illuminate/redis "^10.0"', false);
->with('illuminate/redis "^11.5"', false);

$this->app->instance(ComposerContract::class, $composerMock);

Expand Down
2 changes: 1 addition & 1 deletion tests/Components/UpdaterInstallTest.php
Expand Up @@ -8,7 +8,7 @@
it('installs the required packages', function () {
$composerMock = $this->createMock(ComposerContract::class);

$composerMock->expects($this->once())->method('require')->with('laravel-zero/phar-updater "^1.3"');
$composerMock->expects($this->once())->method('require')->with('laravel-zero/phar-updater "^1.4"');

$this->app->instance(ComposerContract::class, $composerMock);

Expand Down

0 comments on commit 95fd727

Please sign in to comment.