Merge pull request #6903 from open-sausages/pulls/4.0/manifestfilefinder-config-file

Find root modules with _config.php
This commit is contained in:
Damian Mooyman 2017-05-22 13:23:37 +12:00 committed by GitHub
commit 79d3cfd500
6 changed files with 39 additions and 4 deletions

View File

@ -66,6 +66,7 @@ class ManifestFileFinder extends FileFinder
&& !file_exists($pathname . '/' . self::CONFIG_DIR)
&& $basename !== self::CONFIG_DIR // include a root config dir
&& !file_exists("$pathname/../" . self::CONFIG_DIR) // include all paths if a root config dir exists
&& !file_exists("$pathname/../" . self::CONFIG_FILE)// include all paths if a root config file exists
);
if ($lackingConfig) {

View File

@ -15,16 +15,20 @@ class ManifestFileFinderTest extends SapphireTest
public function __construct()
{
$this->base = dirname(__FILE__) . '/fixtures/manifestfilefinder';
$this->defaultBase = dirname(__FILE__) . '/fixtures/manifestfilefinder';
parent::__construct();
}
public function assertFinderFinds($finder, $expect, $message = null)
public function assertFinderFinds($finder, $base, $expect, $message = null)
{
$found = $finder->find($this->base);
if (!$base) {
$base = $this->defaultBase;
}
$found = $finder->find($base);
foreach ($expect as $k => $file) {
$expect[$k] = "{$this->base}/$file";
$expect[$k] = "{$base}/$file";
}
sort($expect);
@ -40,6 +44,7 @@ class ManifestFileFinderTest extends SapphireTest
$this->assertFinderFinds(
$finder,
null,
array(
'module/module.txt'
)
@ -54,6 +59,7 @@ class ManifestFileFinderTest extends SapphireTest
$this->assertFinderFinds(
$finder,
null,
array(
'module/module.txt',
'module/tests/tests.txt',
@ -70,10 +76,38 @@ class ManifestFileFinderTest extends SapphireTest
$this->assertFinderFinds(
$finder,
null,
array(
'module/module.txt',
'themes/themes.txt'
)
);
}
public function testIncludeWithRootConfigFile()
{
$finder = new ManifestFileFinder();
$this->assertFinderFinds(
$finder,
dirname(__FILE__) . '/fixtures/manifestfilefinder_rootconfigfile',
array(
'code/code.txt',
)
);
}
public function testIncludeWithRootConfigFolder()
{
$finder = new ManifestFileFinder();
$this->assertFinderFinds(
$finder,
dirname(__FILE__) . '/fixtures/manifestfilefinder_rootconfigfolder',
array(
'_config/config.yml',
'code/code.txt',
)
);
}
}