stevseea Mon May 19 12:57:28 2008 UTC Modified files: /php-src/ext/dom/tests DOMComment_insertData_error2.phpt DOMComment_insertData_error1.phpt DOMComment_insertData_basic.phpt Log: Tests from PHP London TestFest 2008 http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/DOMComment_insertData_error2.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/dom/tests/DOMComment_insertData_error2.phpt diff -u /dev/null php-src/ext/dom/tests/DOMComment_insertData_error2.phpt:1.2 --- /dev/null Mon May 19 12:57:28 2008 +++ php-src/ext/dom/tests/DOMComment_insertData_error2.phpt Mon May 19 12:57:27 2008 @@ -0,0 +1,24 @@ +--TEST-- +Test inserting data into a DOMComment basic test +--CREDITS-- +Andrew Larssen <[EMAIL PROTECTED]> +London TestFest 2008 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +//offset to large +$dom = new DomDocument(); +$comment = $dom->createComment('test-comment'); +try { + $comment->insertData(999,'-inserted'); +} catch (DOMException $e ) { + if ($e->getMessage() == 'Index Size Error'){ + echo "Throws DOMException for offset too large\n"; + } +} + +?> +--EXPECTF-- +Throws DOMException for offset too large \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/DOMComment_insertData_error1.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/dom/tests/DOMComment_insertData_error1.phpt diff -u /dev/null php-src/ext/dom/tests/DOMComment_insertData_error1.phpt:1.2 --- /dev/null Mon May 19 12:57:28 2008 +++ php-src/ext/dom/tests/DOMComment_insertData_error1.phpt Mon May 19 12:57:28 2008 @@ -0,0 +1,24 @@ +--TEST-- +Test inserting data into a DOMComment basic test +--CREDITS-- +Andrew Larssen <[EMAIL PROTECTED]> +London TestFest 2008 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +//Negative offset +$dom = new DomDocument(); +$comment = $dom->createComment('test-comment'); +try { + $comment->insertData(-1,'-inserted'); +} catch (DOMException $e ) { + if ($e->getMessage() == 'Index Size Error'){ + echo "Throws DOMException for -ve offset\n"; + } +} + +?> +--EXPECTF-- +Throws DOMException for -ve offset http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/DOMComment_insertData_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/dom/tests/DOMComment_insertData_basic.phpt diff -u /dev/null php-src/ext/dom/tests/DOMComment_insertData_basic.phpt:1.2 --- /dev/null Mon May 19 12:57:28 2008 +++ php-src/ext/dom/tests/DOMComment_insertData_basic.phpt Mon May 19 12:57:28 2008 @@ -0,0 +1,21 @@ +--TEST-- +Test inserting data into a DOMComment basic test +--CREDITS-- +Andrew Larssen <[EMAIL PROTECTED]> +London TestFest 2008 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +//correct offset +$dom = new DomDocument(); +$comment = $dom->createComment('test-comment'); +$comment->insertData(4,'-inserted'); +$dom->appendChild($comment); +echo $dom->saveXML(); + +?> +--EXPECTF-- +<?xml version="1.0"?> +<!--test-inserted-comment-->
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php