Annotation of embedaddon/php/ext/dom/tests/DOMDocument_validate_on_parse_variation.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: DOMDocument::$validateOnParse - effectual determination (dom_document_validate_on_parse_read/dom_document_validate_on_parse_write)
! 3: --CREDITS--
! 4: Hans Zaunere
! 5: # TestFest 2009 NYPHP
! 6: --SKIPIF--
! 7: <?php
! 8: require_once('skipif.inc');
! 9: ?>
! 10: --FILE--
! 11: <?php
! 12:
! 13: require_once('dom_test.inc');
! 14:
! 15: chdir(__DIR__ . "/../examples");
! 16: $XMLStringGood = file_get_contents('note.xml');
! 17:
! 18: $dom = new DOMDocument;
! 19: $dom->resolveExternals = TRUE;
! 20:
! 21: $dom->validateOnParse = FALSE;
! 22: echo "validateOnParse set to FALSE: \n";
! 23: $dom->loadXML($XMLStringGood);
! 24: echo "No Error Report Above\n";
! 25:
! 26: $BogusElement = $dom->createElement('NYPHP','DOMinatrix');
! 27: $Body = $dom->getElementsByTagName('from')->item(0);
! 28: $Body->appendChild($BogusElement);
! 29: $XMLStringBad = $dom->saveXML();
! 30:
! 31: echo "validateOnParse set to TRUE: \n";
! 32: $dom->validateOnParse = TRUE;
! 33: $dom->loadXML($XMLStringBad);
! 34: echo "Error Report Above\n";
! 35:
! 36: ?>
! 37: --EXPECTF--
! 38: validateOnParse set to FALSE:
! 39: No Error Report Above
! 40: validateOnParse set to TRUE:
! 41:
! 42: Warning: DOMDocument::loadXML(): No declaration for element NYPHP in Entity, line: %d in %s on line %d
! 43:
! 44: Warning: DOMDocument::loadXML(): Element from was declared #PCDATA but contains non text nodes in Entity, line: %d in %s on line %d
! 45: Error Report Above
! 46:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>