Exemplo n.º 1
0
 public function testUrlToPath()
 {
     $path = DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . 'tao-user-styles.css';
     $urls = array('/style/custom/tao-user-styles.css', 'http://ex.com/style/custom/tao-user-styles.css', 'https://ex.com/style/custom/tao-user-styles.css', 'file://c/style/custom/tao-user-styles.css', 'file://D:/style/custom/tao-user-styles.css');
     foreach ($urls as $url) {
         $this->assertEquals(helpers_File::urlToPath($url), $path);
     }
 }
Exemplo n.º 2
0
 /**
  * Import dependencies files
  *
  * @param QtiResource $qtiItemResource
  * @param $dependencies
  * @return $this
  * @throws AssetManagerException
  */
 public function importDependencyFiles(QtiResource $qtiItemResource, $dependencies)
 {
     $qtiFile = $this->getSource() . \helpers_File::urlToPath($qtiItemResource->getFile());
     foreach ($qtiItemResource->getDependencies() as $dependenciesFile) {
         if (!isset($dependencies[$dependenciesFile])) {
             continue;
         }
         $absolutePath = $this->getAbsolutePath($dependencies[$dependenciesFile]->getFile());
         $relativePath = $this->getRelativePath($qtiFile, $absolutePath);
         try {
             $this->importAsset($absolutePath, $relativePath);
         } catch (\common_Exception $e) {
             throw new AssetManagerException('Error occurs during dependency assets handling for item: ' . $qtiItemResource->getIdentifier() . ', assetFile: ' . $relativePath, 0, $e);
         }
     }
     return $this;
 }