Exemplo n.º 1
0
 public function testSetInvalidTypeMerger()
 {
     $dtd = new slDtdSchema();
     try {
         $dtd->setTypeMerger(new slConfigurableTypeMerger(new slSchemaTypeEqualPatternComparator(), new slSchemaTypeStrictAttributeComparator()));
         $this->fail('Expected exception.');
     } catch (Exception $e) {
         /* Expected */
     }
 }
 /**
  * @dataProvider getSchemaDefinitions
  */
 public function testVisitAutomaton(array $xmlFiles, $name)
 {
     $xsd = new slDtdSchema();
     foreach ($xmlFiles as $file) {
         $xsd->learnFile($file);
     }
     $visitor = new slSchemaXmlSchemaVisitor();
     $result = $visitor->visit($xsd);
     // Read expectation from file, if available
     if (!is_file($file = __DIR__ . '/data/' . $name . '.xsd')) {
         $this->MarkTestSkipped("No comparision file ({$file}) available; Generated result:\n" . $result);
     }
     $this->assertEquals(file_get_contents($file), $result);
 }
Exemplo n.º 3
0
 public function testDtdSchemaMultipleRootElements()
 {
     $dtd = new slDtdSchema();
     $dtd->learnFile(__DIR__ . '/data/simple.xml');
     $dtd->learnFile(__DIR__ . '/data/simple_2.xml');
     $dtd->learnFile(__DIR__ . '/data/simple_3.xml');
     $this->assertEquals(array('root' => 'root', 'xml' => 'xml'), $dtd->getRootElements());
 }