Skip to content

Commit

Permalink
Merge pull request #1134 from mischabraam/fix/resolve-dist-file
Browse files Browse the repository at this point in the history
fix: Resolve dist file path from import
  • Loading branch information
veewee authored Jun 3, 2024
2 parents c9e3209 + e2abf7a commit d1fb490
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
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);
}
}

0 comments on commit d1fb490

Please sign in to comment.