php-src/ext/xmlreader/tests/007.phpt
Stanislav Malyshev 6b896fa57f Merge branch 'pull-request/320'
* pull-request/320:
  this is test 5 not 6
  fix race condition
  more shared names that create race conditions
  change to a unique filename
  more shared filenames
  yet another shared filename
  don't share a filename to stop race conditions
  fix race condition for 2-4 and normalize names for others
  fix race condition when running tests in parallel
  clean up after test
  Fix #64572: Clean up after the test
  Fix #64572: Clean up after the test
2013-06-17 01:06:01 -07:00

58 lines
1.1 KiB
PHP

--TEST--
XMLReader: libxml2 XML Reader, setRelaxNGSchema
--SKIPIF--
<?php if (!extension_loaded("xmlreader")) print "skip"; ?>
--FILE--
<?php
/* $Id$ */
$xmlstring = '<TEI.2>hello</TEI.2>';
$relaxngfile = dirname(__FILE__) . '/relaxNG.rng';
$file = dirname(__FILE__) . '/_007.xml';
file_put_contents($file, $xmlstring);
$reader = new XMLReader();
$reader->open($file);
if ($reader->setRelaxNGSchema($relaxngfile)) {
while ($reader->read());
}
if ($reader->isValid()) {
print "file relaxNG: ok\n";
} else {
print "file relaxNG: failed\n";
}
$reader->close();
unlink($file);
$reader = new XMLReader();
$reader->XML($xmlstring);
if ($reader->setRelaxNGSchema($relaxngfile)) {
while ($reader->read());
}
if ($reader->isValid()) {
print "string relaxNG: ok\n";
} else {
print "string relaxNG: failed\n";
}
$reader->close();
$reader = new XMLReader();
$reader->XML($xmlstring);
if ($reader->setRelaxNGSchema('')) {
echo 'failed';
}
$reader->close();
?>
===DONE===
--EXPECTF--
file relaxNG: ok
string relaxNG: ok
Warning: XMLReader::setRelaxNGSchema(): Schema data source is required in %s on line %d
===DONE===