Skip to content

Commit

Permalink
Use contao.web_dir instead of hardcoded web dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolineus authored and leofeyer committed Nov 26, 2018
1 parent deca785 commit 3f80900
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions manager-bundle/src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ final class Configuration implements ConfigurationInterface
/**
* @var string
*/
private $projectDir;
private $webDir;

/**
* @param string $projectDir
* @param string $webDir
*/
public function __construct(string $projectDir)
public function __construct(string $webDir)
{
$this->projectDir = $projectDir;
$this->webDir = $webDir;
}

/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('contao_manager');
Expand All @@ -46,14 +46,14 @@ public function getConfigTreeBuilder()
->validate()
->always(
function (?string $path): ?string {
if (null === $path || is_file($this->projectDir . '/web/' . $path)) {
if (null === $path || is_file($this->webDir . '/' . $path)) {
return $path;
}

throw new InvalidConfigurationException(
sprintf(
'contao_manager.manager_path is configured but file "%s" does not exist.',
$this->projectDir . '/web/' . $path
$this->webDir . '/' . $path
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ContaoManagerExtension extends ConfigurableExtension
*/
public function getConfiguration(array $config, ContainerBuilder $container)
{
return new Configuration($container->getParameter('kernel.project_dir'));
return new Configuration($container->getParameter('contao.web_dir'));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testCanBeInstantiated(): void
public function testCustomManagerPath(): void
{
$fs = new Filesystem();
$fs->dumpFile($this->getTempDir() . '/web/custom.phar.php', '');
$fs->dumpFile($this->getTempDir() . '/custom.phar.php', '');

$params = [
'contao_manager' => [
Expand Down

0 comments on commit 3f80900

Please sign in to comment.