public function testGetModulePath() { $oMap = new ModuleMap(VSC_FIXTURE_PATH . 'config/map.php', '\\A.*\\Z'); $oMap->setTemplatePath('templates/'); $oMap->setTemplate('main.tpl.php'); $this->assertEquals(VSC_FIXTURE_PATH, $oMap->getModulePath()); }
public function testBasicSetMainTemplatePath() { $o = new ModuleMap('.*', __FILE__); $this->assertEmpty($o->getMainTemplatePath()); $path = VSC_FIXTURE_PATH . 'templates/'; $o->setMainTemplatePath($path); $this->assertEquals($path, $o->getMainTemplatePath()); }
public function testInitialization() { $r = ''; $o = new ModuleMap(VSC_FIXTURE_PATH . 'config/map.php', $r); $this->assertEquals(VSC_FIXTURE_PATH, $o->getPath()); $this->assertEquals($r, $o->getRegex()); $this->assertEquals(VSC_RES_PATH . 'templates' . DIRECTORY_SEPARATOR, $o->getTemplatePath()); }
/** * @return MappingA|null */ public function getParentModuleMap() { if (MappingA::isValid($this->oCurrentModuleMap)) { $oParentModule = $this->oCurrentModuleMap->getModuleMap(); if (ModuleMap::isValid($oParentModule)) { return $oParentModule; } } // return a default root node return new ModuleMap(VSC_RES_PATH . 'config/map.php', ''); }
public function testEmptyAtInitialization() { $o = new ModuleMap('.*', __FILE__); $this->assertEmpty($o->getMainTemplate()); }
/** * @param string $sPath * @return string * @throws ExceptionSitemap */ protected function getValidPath($sPath) { if (!is_dir($sPath)) { if (!ModuleMap::isValid($this) && !ModuleMap::isValid($this->getModuleMap())) { throw new ExceptionSitemap('No reference module path to use for relative paths'); } $sPath = $this->getModulePath() . $sPath; } $sPath = realpath($sPath); if (!is_dir($sPath)) { throw new ExceptionSitemap('Template path is not valid.'); } return $sPath . DIRECTORY_SEPARATOR; }