summaryrefslogtreecommitdiff
path: root/ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt
blob: a02da0f0fde72547417b5450fe1cbaf101b21a11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--TEST--
DOMDocument::$validateOnParse - effectual determination (dom_document_validate_on_parse_read/dom_document_validate_on_parse_write)
--CREDITS--
Hans Zaunere
# TestFest 2009 NYPHP
--SKIPIF--
<?php
require_once('skipif.inc');
?>
--FILE--
<?php

require_once('dom_test.inc');

chdir(__DIR__ . "/../examples");
$XMLStringGood = file_get_contents('note.xml');

$dom = new DOMDocument;
$dom->resolveExternals = TRUE;

$dom->validateOnParse = FALSE;
echo "validateOnParse set to FALSE: \n";
$dom->loadXML($XMLStringGood);
echo "No Error Report Above\n";

$BogusElement = $dom->createElement('NYPHP','DOMinatrix');
$Body = $dom->getElementsByTagName('from')->item(0);
$Body->appendChild($BogusElement);
$XMLStringBad = $dom->saveXML();

echo "validateOnParse set to TRUE: \n";
$dom->validateOnParse = TRUE;
$dom->loadXML($XMLStringBad);
echo "Error Report Above\n";

?>
--EXPECTF--
validateOnParse set to FALSE: 
No Error Report Above
validateOnParse set to TRUE: 

Warning: DOMDocument::loadXML(): Entity 'nbsp' not defined in Entity, line: %d in %s on line %d

Warning: DOMDocument::loadXML(): Entity 'copy' not defined in Entity, line: %d in %s on line %d

Warning: DOMDocument::loadXML(): No declaration for element NYPHP in Entity, line: %d in %s on line %d

Warning: DOMDocument::loadXML(): Element from was declared #PCDATA but contains non text nodes in Entity, line: %d in %s on line %d
Error Report Above