Annotation of embedaddon/php/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: DomDocument::$strictErrorChecking - ensure turning off actually works
! 3: --CREDITS--
! 4: Vincent Tsao <notes4vincent@gmail.com>
! 5: (and Dan Convissor)
! 6: # TestFest 2009 NYPHP
! 7: --SKIPIF--
! 8: <?php require_once('skipif.inc'); ?>
! 9: --FILE--
! 10: <?php
! 11:
! 12: echo "Load document\n";
! 13: $doc = new DOMDocument;
! 14: $doc->load(dirname(__FILE__)."/book.xml");
! 15:
! 16: echo "See if strictErrorChecking is on\n";
! 17: var_dump($doc->strictErrorChecking);
! 18:
! 19: echo "Should throw DOMException when strictErrorChecking is on\n";
! 20: try {
! 21: $attr = $doc->createAttribute(0);
! 22: } catch (DOMException $e) {
! 23: echo "GOOD. DOMException thrown\n";
! 24: echo $e->getMessage() ."\n";
! 25: } catch (Exception $e) {
! 26: echo "OOPS. Other exception thrown\n";
! 27: }
! 28:
! 29:
! 30: echo "Turn strictErrorChecking off\n";
! 31: $doc->strictErrorChecking = false;
! 32:
! 33: echo "See if strictErrorChecking is off\n";
! 34: var_dump($doc->strictErrorChecking);
! 35:
! 36: echo "Should raise PHP error because strictErrorChecking is off\n";
! 37: try {
! 38: $attr = $doc->createAttribute(0);
! 39: } catch (DOMException $e) {
! 40: echo "OOPS. DOMException thrown\n";
! 41: echo $e->getMessage() ."\n";
! 42: } catch (Exception $e) {
! 43: echo "OOPS. Other exception thrown\n";
! 44: }
! 45:
! 46: ?>
! 47: --EXPECTF--
! 48: Load document
! 49: See if strictErrorChecking is on
! 50: bool(true)
! 51: Should throw DOMException when strictErrorChecking is on
! 52: GOOD. DOMException thrown
! 53: Invalid Character Error
! 54: Turn strictErrorChecking off
! 55: See if strictErrorChecking is off
! 56: bool(false)
! 57: Should raise PHP error because strictErrorChecking is off
! 58:
! 59: Warning: DOMDocument::createAttribute(): Invalid Character Error in %sDOMDocument_strictErrorChecking_variation.php on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>