mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
2aa3b5d5fa
commit
a433e5f4a8
@ -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) {
|
||||
|
@ -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',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user