Skip to content

Commit d1fb490

Browse files
authored
Merge pull request #1134 from mischabraam/fix/resolve-dist-file
fix: Resolve dist file path from import
2 parents c9e3209 + e2abf7a commit d1fb490

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/Configuration/ContainerBuilder.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ public static function buildFromConfiguration(string $path): SymfonyContainerBui
2828

2929
// Load basic service file + custom user configuration
3030
$configDir = dirname(__DIR__, 2).$filesystem->ensureValidSlashes('/resources/config');
31-
$loader = LoaderFactory::createLoader($container, [$configDir]);
31+
$configFileDir = dirname($path);
32+
$loader = LoaderFactory::createLoader(
33+
$container,
34+
[$configDir, $configFileDir]
35+
);
3236
$loader->load('config.yml');
3337
$loader->load('console.yml');
3438
$loader->load('fixer.yml');

test/E2E/ConfigurationTest.php

+24
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,28 @@ function it_should_be_able_to_resolve_env_variable_in_configuration()
3737
$process->getOutput(),
3838
);
3939
}
40+
41+
/** @test */
42+
function it_should_be_able_to_resolve_dist_file_imports()
43+
{
44+
$this->initializeGitInRootDir();
45+
$this->initializeComposer($this->rootDir);
46+
47+
// grumphp.yml file.
48+
$grumphpFile = $this->initializeGrumphpConfig(path: $this->rootDir, customConfig: [
49+
'imports' => [
50+
['resource' => 'grumphp.yml.dist']
51+
],
52+
]);
53+
// grumphp.yml.dist file which is imported, doesn't matter what's in this imported file.
54+
$grumphpDistFile = $this->initializeGrumphpConfig(path: $this->rootDir, fileName: 'grumphp.yml.dist');
55+
56+
$this->installComposer($this->rootDir);
57+
$this->ensureHooksExist($this->rootDir);
58+
59+
$this->enableValidatePathsTask($grumphpFile, $this->rootDir);
60+
61+
$this->commitAll($this->rootDir);
62+
$this->runGrumphp($this->rootDir);
63+
}
4064
}

0 commit comments

Comments
 (0)