コード例 #1
0
ファイル: PhpDocumentTest.php プロジェクト: hutnikau/qti-sdk
 /**
  *
  * @dataProvider loadTestSamplesDataProvider
  * @param string $testUri
  * @param string $rootType The expected fully qualified class name of the document component.
  */
 public function testLoadTestSamples($testUri, $rootType)
 {
     // Basic XML -> PHP transormation + save + load
     $xmlDoc = new XmlDocument('2.1');
     $xmlDoc->load($testUri);
     $phpDoc = new PhpDocument();
     $phpDoc->setDocumentComponent($xmlDoc->getDocumentComponent());
     $file = tempnam('/tmp', 'qsm');
     $phpDoc->save($file);
     $phpDoc = new PhpDocument();
     $phpDoc->load($file);
     $this->assertInstanceOf($rootType, $phpDoc->getDocumentComponent());
     $this->assertEquals($file, $phpDoc->getUrl());
     unlink($file);
     $this->assertFalse(file_exists($file));
 }