cvs: php-src /ext/dom/tests DOMComment_replaceData_basic.phpt DOMComment_replaceData_error1.phpt DOMComment_replaceData_error2.phpt

From: Date: Sat, 17 May 2008 13:26:51 +0000
Subject: cvs: php-src /ext/dom/tests DOMComment_replaceData_basic.phpt DOMComment_replaceData_error1.phpt DOMComment_replaceData_error2.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-50004@lists.php.net to get a copy of this message
zoe Sat May 17 13:26:51 2008 UTC Modified files: /php-src/ext/dom/tests DOMComment_replaceData_error1.phpt DOMComment_replaceData_basic.phpt DOMComment_replaceData_error2.phpt Log: Tests from London test fest 2008 http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/DOMComment_replaceData_error1.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/dom/tests/DOMComment_replaceData_error1.phpt diff -u /dev/null php-src/ext/dom/tests/DOMComment_replaceData_error1.phpt:1.2 --- /dev/null Sat May 17 13:26:51 2008 +++ php-src/ext/dom/tests/DOMComment_replaceData_error1.phpt Sat May 17 13:26:51 2008 @@ -0,0 +1,24 @@ +--TEST-- +Test replacing data into a DOMComment basic test +--CREDITS-- +Andrew Larssen <al@larssen.org> +London TestFest 2008 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +//Negative offset +$dom = new DomDocument(); +$comment = $dom->createComment('test-comment'); +try { + $comment->replaceData(-1,4,'-inserted'); +} catch (DOMException $e ) { + if ($e->getMessage() == 'Index Size Error'){ + echo "Throws DOMException for -ve offest\n"; + } +} + +?> +--EXPECTF-- +Throws DOMException for -ve offest http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/DOMComment_replaceData_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/dom/tests/DOMComment_replaceData_basic.phpt diff -u /dev/null php-src/ext/dom/tests/DOMComment_replaceData_basic.phpt:1.2 --- /dev/null Sat May 17 13:26:51 2008 +++ php-src/ext/dom/tests/DOMComment_replaceData_basic.phpt Sat May 17 13:26:51 2008 @@ -0,0 +1,29 @@ +--TEST-- +Test replacing data into a DOMComment basic test +--CREDITS-- +Andrew Larssen <al@larssen.org> +London TestFest 2008 +--SKIPIF-- +<?php // require_once('skipif.inc'); ?> +--FILE-- +<?php + +$dom = new DomDocument(); +$comment = $dom->createComment('test-comment'); +$comment->replaceData(4,1,'replaced'); +$dom->appendChild($comment); +echo $dom->saveXML(); + +// Replaces rest of string if count is greater than length of existing string +$dom = new DomDocument(); +$comment = $dom->createComment('test-comment'); +$comment->replaceData(0,50,'replaced'); +$dom->appendChild($comment); +echo $dom->saveXML(); + +?> +--EXPECTF-- +<?xml version="1.0"?> +<!--testreplacedcomment--> +<?xml version="1.0"?> +<!--replaced--> http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/DOMComment_replaceData_error2.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/dom/tests/DOMComment_replaceData_error2.phpt diff -u /dev/null php-src/ext/dom/tests/DOMComment_replaceData_error2.phpt:1.2 --- /dev/null Sat May 17 13:26:51 2008 +++ php-src/ext/dom/tests/DOMComment_replaceData_error2.phpt Sat May 17 13:26:51 2008 @@ -0,0 +1,24 @@ +--TEST-- +Test replacing data into a DOMComment basic test +--CREDITS-- +Andrew Larssen <al@larssen.org> +London TestFest 2008 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +//offset to large +$dom = new DomDocument(); +$comment = $dom->createComment('test-comment'); +try { + $comment->replaceData(999,4,'-inserted'); +} catch (DOMException $e ) { + if ($e->getMessage() == 'Index Size Error'){ + echo "Throws DOMException for offest too large\n"; + } +} + +?> +--EXPECTF-- +Throws DOMException for offest too large \ No newline at end of file

« previous php.cvs (#50004) next »