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