Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Resolve dist file path from import #1134

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Configuration/ContainerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ public static function buildFromConfiguration(string $path): SymfonyContainerBui

// Load basic service file + custom user configuration
$configDir = dirname(__DIR__, 2).$filesystem->ensureValidSlashes('/resources/config');
$loader = LoaderFactory::createLoader($container, [$configDir]);
$configFileDir = dirname($path);
$loader = LoaderFactory::createLoader(
$container,
[$configDir, $configFileDir]
);
$loader->load('config.yml');
$loader->load('console.yml');
$loader->load('fixer.yml');
Expand Down
24 changes: 24 additions & 0 deletions test/E2E/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,28 @@ function it_should_be_able_to_resolve_env_variable_in_configuration()
$process->getOutput(),
);
}

/** @test */
function it_should_be_able_to_resolve_dist_file_imports()
{
$this->initializeGitInRootDir();
$this->initializeComposer($this->rootDir);

// grumphp.yml file.
$grumphpFile = $this->initializeGrumphpConfig(path: $this->rootDir, customConfig: [
'imports' => [
['resource' => 'grumphp.yml.dist']
],
]);
// grumphp.yml.dist file which is imported, doesn't matter what's in this imported file.
$grumphpDistFile = $this->initializeGrumphpConfig(path: $this->rootDir, fileName: 'grumphp.yml.dist');

$this->installComposer($this->rootDir);
$this->ensureHooksExist($this->rootDir);

$this->enableValidatePathsTask($grumphpFile, $this->rootDir);

$this->commitAll($this->rootDir);
$this->runGrumphp($this->rootDir);
}
}