Module->getResourcePath()

Based on Sam's feedback in https://github.com/silverstripe/silverstripe-framework/pull/6733
This commit is contained in:
Ingo Schommer 2017-03-28 17:22:30 +13:00
parent 874c6ccdd4
commit 556c9a537e
2 changed files with 3 additions and 3 deletions

View File

@ -161,7 +161,7 @@ class Module implements Serializable
* @param string $path File or directory path relative to module directory * @param string $path File or directory path relative to module directory
* @return string Path relative to base directory * @return string Path relative to base directory
*/ */
public function getResource($path) public function getResourcePath($path)
{ {
return File::join_paths($this->getRelativePath(), $path); return File::join_paths($this->getRelativePath(), $path);
} }
@ -175,7 +175,7 @@ class Module implements Serializable
*/ */
public function hasResource($path) public function hasResource($path)
{ {
$resource = $this->getResource($path); $resource = $this->getResourcePath($path);
return file_exists($this->basePath . '/' . $resource); return file_exists($this->basePath . '/' . $resource);
} }
} }

View File

@ -81,7 +81,7 @@ class ModuleManifestTest extends SapphireTest
$this->assertFalse($module->hasResource('package.json')); $this->assertFalse($module->hasResource('package.json'));
$this->assertEquals( $this->assertEquals(
'moduleb/composer.json', 'moduleb/composer.json',
$module->getResource('composer.json') $module->getResourcePath('composer.json')
); );
} }
} }