/** * Befüllt den Record Pfaden * * @param string $sPath * @return tx_mklib_model_Dam */ public function fillPath($sPath = false) { // Pathname immer setzen! if (!$this->hasFilePath()) { if (tx_rnbase_util_TYPO3::isTYPO60OrHigher()) { $this->setFilePathName($this->getUrl()); } else { $this->setFilePathName($this->getFilePath() . $this->getFileName()); } } tx_rnbase::load('tx_mklib_util_File'); // webpath setzen if ((!$sPath || $sPath == 'webpath') && !$this->hasFileWebpath()) { $this->setFileWebpath(tx_mklib_util_File::getWebPath($this->getFilePathName())); } // serverpath setzen if ((!$sPath || $sPath == 'serverpath') && !$this->hasFileServerpath()) { $this->setFileServerpath(tx_mklib_util_File::getServerPath($this->getFilePathName())); } // relpath setzen if ((!$sPath || $sPath == 'relpath') && !$this->hasFileRelpath()) { $this->setFileRelpath(tx_mklib_util_File::getRelPath($this->getFilePathName())); } return $this; }
/** * getWebPath testen */ public function testGetWebPath() { if (defined('TYPO3_cliMode') && TYPO3_cliMode) { $this->markTestSkipped('Geht leider nicht unter CLI.'); } $pathSite = tx_mklib_util_File::getDocumentRoot(); $siteUrl = tx_mklib_util_File::getSiteUrl(); $this->assertEquals($siteUrl, tx_mklib_util_File::getWebPath()); $this->assertEquals($siteUrl . 'typo3conf/', tx_mklib_util_File::getWebPath($siteUrl . '/typo3conf')); $this->assertEquals($siteUrl . 'typo3conf/', tx_mklib_util_File::getWebPath($pathSite . '\\typo3conf')); $this->assertEquals($siteUrl . 'typo3conf/', tx_mklib_util_File::getWebPath('/typo3conf')); $this->assertEquals($siteUrl . 'typo3conf/localconf.php', tx_mklib_util_File::getWebPath($pathSite . '/typo3conf\\localconf.php')); $this->assertEquals($siteUrl . 'typo3conf/localconf.php', tx_mklib_util_File::getWebPath('typo3conf\\localconf.php')); }