mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00: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
@ -210,6 +210,20 @@ class SS_ClassManifest {
|
|||||||
return $this->configs;
|
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.
|
* Completely regenerates the manifest file.
|
||||||
*
|
*
|
||||||
@ -252,7 +266,7 @@ class SS_ClassManifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function handleFile($basename, $pathname, $depth) {
|
public function handleFile($basename, $pathname, $depth) {
|
||||||
if ($depth == 1 && $basename == self::CONF_FILE) {
|
if ($basename == self::CONF_FILE) {
|
||||||
$this->configs[] = $pathname;
|
$this->configs[] = $pathname;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,12 @@ class ClassManifestTest extends SapphireTest {
|
|||||||
$this->assertEquals($expect, $this->manifestTests->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() {
|
public function testTestManifestIncludesTestClasses() {
|
||||||
$this->assertNotContains('testclassa', array_keys($this->manifest->getClasses()));
|
$this->assertNotContains('testclassa', array_keys($this->manifest->getClasses()));
|
||||||
$this->assertContains('testclassa', array_keys($this->manifestTests->getClasses()));
|
$this->assertContains('testclassa', array_keys($this->manifestTests->getClasses()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user