public function testExplodeRubricBlocks()
 {
     $src = self::samplesDir() . 'custom/runtime/rubricblockrefs_explosion.xml';
     $doc = new XmlCompactDocument();
     $doc->load($src, true);
     $doc->setExplodeRubricBlocks(true);
     $file = tempnam('/tmp', 'qsm');
     $doc->save($file);
     // Are external rubricBlocks set?
     $pathinfo = pathinfo($file);
     $path = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . 'rubricBlock_RB_S01_1.xml';
     $this->assertTrue(file_exists($path));
     unlink($path);
     $this->assertFalse(file_exists($path));
     $path = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . 'rubricBlock_RB_S01_2.xml';
     $this->assertTrue(file_exists($path));
     unlink($path);
     $this->assertFalse(file_exists($path));
     unlink($file);
 }
コード例 #2
0
 /**
  * Explode the rubric blocks of the test definition into separate QTI-XML files and
  * remove the compact XML document from the file system (useless for
  * the rest of the compilation process).
  * 
  * @param XmlCompactDocument $compiledDoc
  */
 protected function explodeRubricBlocks(XmlCompactDocument $compiledDoc)
 {
     $savePath = $this->getPrivateDirectory()->getPath() . 'compact-test.xml';
     $compiledDoc->setExplodeRubricBlocks(true);
     $compiledDoc->save($savePath);
     unlink($savePath);
 }