From 2b20e3d9140ed39281a80f60bfd5ebcf571b5721 Mon Sep 17 00:00:00 2001 From: Steve Seear Date: Mon, 19 May 2008 12:56:21 +0000 Subject: [PATCH] Tests from PHP London TestFest 2008 --- .../tests/DOMComment_insertData_basic.phpt | 21 ++++++++++++++++ .../tests/DOMComment_insertData_error1.phpt | 24 +++++++++++++++++++ .../tests/DOMComment_insertData_error2.phpt | 24 +++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 ext/dom/tests/DOMComment_insertData_basic.phpt create mode 100644 ext/dom/tests/DOMComment_insertData_error1.phpt create mode 100644 ext/dom/tests/DOMComment_insertData_error2.phpt diff --git a/ext/dom/tests/DOMComment_insertData_basic.phpt b/ext/dom/tests/DOMComment_insertData_basic.phpt new file mode 100644 index 0000000000..5a4857d677 --- /dev/null +++ b/ext/dom/tests/DOMComment_insertData_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test inserting data into a DOMComment basic test +--CREDITS-- +Andrew Larssen +London TestFest 2008 +--SKIPIF-- + +--FILE-- +createComment('test-comment'); +$comment->insertData(4,'-inserted'); +$dom->appendChild($comment); +echo $dom->saveXML(); + +?> +--EXPECTF-- + + diff --git a/ext/dom/tests/DOMComment_insertData_error1.phpt b/ext/dom/tests/DOMComment_insertData_error1.phpt new file mode 100644 index 0000000000..56922ac518 --- /dev/null +++ b/ext/dom/tests/DOMComment_insertData_error1.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test inserting data into a DOMComment basic test +--CREDITS-- +Andrew Larssen +London TestFest 2008 +--SKIPIF-- + +--FILE-- +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 diff --git a/ext/dom/tests/DOMComment_insertData_error2.phpt b/ext/dom/tests/DOMComment_insertData_error2.phpt new file mode 100644 index 0000000000..d2affa89e7 --- /dev/null +++ b/ext/dom/tests/DOMComment_insertData_error2.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test inserting data into a DOMComment basic test +--CREDITS-- +Andrew Larssen +London TestFest 2008 +--SKIPIF-- + +--FILE-- +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 -- 2.40.0