Annotation of embedaddon/php/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: DOMDocument::relaxNGValidateSource() should fail if document doesn't validate
! 3: --CREDITS--
! 4: Knut Urdalen <knut@php.net>
! 5: --SKIPIF--
! 6: <?php
! 7: require_once('skipif.inc');
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11: $rng = <<< RNG
! 12: <?xml version="1.0" encoding="UTF-8"?>
! 13: <grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
! 14: datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
! 15: <start>
! 16: <element name="apple">
! 17: <element name="pear">
! 18: <data type="NCName"/>
! 19: </element>
! 20: </element>
! 21: </start>
! 22: </grammar>
! 23: RNG;
! 24:
! 25: $bad_xml = <<< BAD_XML
! 26: <?xml version="1.0"?>
! 27: <apple>
! 28: <pear>Pear</pear>
! 29: <pear>Pear</pear>
! 30: </apple>
! 31: BAD_XML;
! 32:
! 33: $doc = new DOMDocument();
! 34: $doc->loadXML($bad_xml);
! 35: $result = $doc->relaxNGValidateSource($rng);
! 36: var_dump($result);
! 37:
! 38: ?>
! 39: --EXPECTF--
! 40: Warning: DOMDocument::relaxNGValidateSource(): Did not expect element pear there in %s on line %d
! 41: bool(false)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>