Пример #1
0
 public function getIterator()
 {
     $iterator = new \AppendIterator();
     // english pack is always empty since in default rdfs
     if ($this->langCode != 'en-US') {
         foreach ($this->extension->getManifest()->getInstallModelFiles() as $rdfpath) {
             $modelId = FileModel::getModelIdFromXml($rdfpath);
             $candidate = $this->extension->getDir() . 'locales' . DIRECTORY_SEPARATOR . $this->langCode . DIRECTORY_SEPARATOR . basename($rdfpath) . '.po';
             if (file_exists($candidate)) {
                 $iterator->append($this->getTriplesFromFile($candidate, $modelId));
             }
         }
     }
     return $iterator;
 }
Пример #2
0
 /**
  * @dataProvider modelProvider
  * 
  * @author Lionel Lecaque, lionel@taotesting.com
  */
 public function testGetModelIdFromXml($id, $file)
 {
     try {
         $modelid = FileModel::getModelIdFromXml($file);
         $this->assertEquals($id, $modelid);
     } catch (\Exception $e) {
         $this->assertInstanceOf('\\common_exception_Error', $e);
         if ($id == 100) {
             $this->assertContains('has to be defined with the "xml:base" attribute of the ROOT node', $e->getMessage());
         } else {
             $this->fail('unexpected error');
         }
     }
 }
Пример #3
0
 /**
  * 
  * @param string $file
  * @param string $forceModelId
  */
 public function __construct($file, $forceModelId = null)
 {
     $modelId = is_null($forceModelId) ? FileModel::getModelIdFromXml($file) : $forceModelId;
     $this->load($modelId, $file);
 }