Skip to content

Commit

Permalink
Updated local_dir to be optional
Browse files Browse the repository at this point in the history
the `datawarehouse` test specified in `xdmod_config.json` didn't need a
`local_dir` so this was removed. To account for some entries having a local_dir
and others not I updated the config object construction to account for this.
  • Loading branch information
ryanrath committed Mar 4, 2019
1 parent e5c2503 commit 242bd83
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,31 +159,38 @@ public function testXdmodConfiguration(array $options)
$baseDir = dirname($this->testFiles->getFile('configuration', '.', 'input'));
$baseFile = $this->testFiles->getFile('configuration', $options['base_file'], 'input');

$localDir = $this->interpretDirOption($options['local_dir']);
$localConfigDir = dirname(
$this->testFiles->getfile(
'configuration',
implode(
DIRECTORY_SEPARATOR,
array(
'.',
$localDir,
'.')
),
'input'
)
);

$expectedFilePath = $this->testFiles->getFile('configuration', $options['expected']);

$config = new XdmodConfiguration(
$baseFile,
$baseDir,
null,
array(
'local_config_dir' => $localConfigDir
)
);
if (isset($options['local_dir'])) {
$localDir = $this->interpretDirOption($options['local_dir']);
$localConfigDir = dirname(
$this->testFiles->getfile(
'configuration',
implode(
DIRECTORY_SEPARATOR,
array(
'.',
$localDir,
'.')
),
'input'
)
);
$config = new XdmodConfiguration(
$baseFile,
$baseDir,
null,
array(
'local_config_dir' => $localConfigDir
)
);
} else {
$config = new XdmodConfiguration(
$baseFile,
$baseDir
);
}

$config->initialize();

$actual = sprintf("%s\n", $config->toJson());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
[
{
"base_file": "datawarehouse",
"local_dir": ["datawarehouse.d"],
"expected": "xdmod_config_datawarehouse"
}
],
Expand Down

0 comments on commit 242bd83

Please sign in to comment.