コード例 #1
0
 /**
  * @depends testTestFeedbackRefLoad
  */
 public function testFeedbackRefSave()
 {
     $src = self::samplesDir() . 'custom/runtime/test_feedback_refs.xml';
     $doc = new XmlCompactDocument();
     $doc->load($src, true);
     $file = tempnam('/tmp', 'qsm');
     $doc->save($file);
     $doc = new DOMDocument('1.0', 'UTF-8');
     $doc->load($file);
     $testFeedbackRefElts = $doc->getElementsByTagName('testFeedbackRef');
     $this->assertEquals(3, $testFeedbackRefElts->length);
     $testFeedbackRefElt1 = $testFeedbackRefElts->item(0);
     $this->assertEquals('feedback1', $testFeedbackRefElt1->getAttribute('identifier'));
     $this->assertEquals('atEnd', $testFeedbackRefElt1->getAttribute('access'));
     $this->assertEquals('show', $testFeedbackRefElt1->getAttribute('showHide'));
     $this->assertEquals('showme', $testFeedbackRefElt1->getAttribute('outcomeIdentifier'));
     $this->assertEquals('./TF01.xml', $testFeedbackRefElt1->getAttribute('href'));
     $testFeedbackRefElt2 = $testFeedbackRefElts->item(1);
     $this->assertEquals('feedback2', $testFeedbackRefElt2->getAttribute('identifier'));
     $this->assertEquals('atEnd', $testFeedbackRefElt2->getAttribute('access'));
     $this->assertEquals('show', $testFeedbackRefElt2->getAttribute('showHide'));
     $this->assertEquals('showme', $testFeedbackRefElt2->getAttribute('outcomeIdentifier'));
     $this->assertEquals('./TF02.xml', $testFeedbackRefElt2->getAttribute('href'));
     $testFeedbackRefElt3 = $testFeedbackRefElts->item(2);
     $this->assertEquals('mainfeedback1', $testFeedbackRefElt3->getAttribute('identifier'));
     $this->assertEquals('during', $testFeedbackRefElt3->getAttribute('access'));
     $this->assertEquals('show', $testFeedbackRefElt3->getAttribute('showHide'));
     $this->assertEquals('showme', $testFeedbackRefElt3->getAttribute('outcomeIdentifier'));
     $this->assertEquals('./TFMAIN.xml', $testFeedbackRefElt3->getAttribute('href'));
 }
 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);
 }
コード例 #3
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);
 }