Find root modules with _config.php

When modules are installed as the webroot,
manifest generation should behave the same way as when they're in a subfolder.
Which means accepting the module folder both with a _config/ folder
and a _config.php file present.
This commit is contained in:
Ingo Schommer 2017-05-10 21:24:12 +12:00 committed by Damian Mooyman
parent 2aa3b5d5fa
commit a433e5f4a8
5 changed files with 38 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,37 @@ 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(
'code/code.txt',
)
);
}
}