mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Added ClassManifest->getModules(), and removed limitation to toplevel modules in ClassManifest->handleFile() (necessary to detect new sapphire/admin/ "submodule")
This commit is contained in:
parent
afbb4cc045
commit
37774d4103
@ -209,6 +209,20 @@ class SS_ClassManifest {
|
||||
public function getConfigs() {
|
||||
return $this->configs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of module names mapped to their paths.
|
||||
* "Modules" in sapphire are simply directories with a _config.php file.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getModules() {
|
||||
$modules = array();
|
||||
foreach($this->configs as $configPath) {
|
||||
$modules[basename(dirname($configPath))] = dirname($configPath);
|
||||
}
|
||||
return $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Completely regenerates the manifest file.
|
||||
@ -252,7 +266,7 @@ class SS_ClassManifest {
|
||||
}
|
||||
|
||||
public function handleFile($basename, $pathname, $depth) {
|
||||
if ($depth == 1 && $basename == self::CONF_FILE) {
|
||||
if ($basename == self::CONF_FILE) {
|
||||
$this->configs[] = $pathname;
|
||||
return;
|
||||
}
|
||||
|
@ -105,6 +105,12 @@ class ClassManifestTest extends SapphireTest {
|
||||
$this->assertEquals($expect, $this->manifest->getConfigs());
|
||||
$this->assertEquals($expect, $this->manifestTests->getConfigs());
|
||||
}
|
||||
|
||||
public function testGetModules() {
|
||||
$expect = array("module" => "{$this->base}/module");
|
||||
$this->assertEquals($expect, $this->manifest->getModules());
|
||||
$this->assertEquals($expect, $this->manifestTests->getModules());
|
||||
}
|
||||
|
||||
public function testTestManifestIncludesTestClasses() {
|
||||
$this->assertNotContains('testclassa', array_keys($this->manifest->getClasses()));
|
||||
|
Loading…
Reference in New Issue
Block a user