summaryrefslogtreecommitdiff
path: root/ext/dom
diff options
context:
space:
mode:
authorEric Stewart <ericstewart@php.net>2009-05-25 06:03:41 +0000
committerEric Stewart <ericstewart@php.net>2009-05-25 06:03:41 +0000
commitd9c9d4cf4b4e54e30d15d6ccda8564e1e206b85f (patch)
tree9823c05005333c45fdf20e29b66300f6c4d01228 /ext/dom
parent00a554b4a3c1ae9c254f230e96837a44f11d4b13 (diff)
downloadphp-git-d9c9d4cf4b4e54e30d15d6ccda8564e1e206b85f.tar.gz
Add the following new tests:
DOMCharacterData::appendData() with no arguments. DOMCharacterData::deleteData() with count exceeding string size. DOMCharacterData::deleteData() with no arguments. DOMCharacterData::deleteData() with offset exceeding string size. DOMCharacterData::insertData() with no arguments. DOMCharacterData::replaceData() with no arguments. DOMComment::__construct() with more arguments than acceptable. DOMDocumentFragment::__construct(). DOMDocumentFragment::__construct() with too many errors. DOMDocumentFragment::appendXML() with no arguments. DOMDocumentFragment::appendXML() with children with properties.
Diffstat (limited to 'ext/dom')
-rw-r--r--ext/dom/tests/DOMCharacterData_appendData_error_001.phpt19
-rw-r--r--ext/dom/tests/DOMCharacterData_deleteData_basic_001.phpt20
-rw-r--r--ext/dom/tests/DOMCharacterData_deleteData_error_001.phpt19
-rw-r--r--ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt23
-rw-r--r--ext/dom/tests/DOMCharacterData_insertData_error_001.phpt19
-rw-r--r--ext/dom/tests/DOMCharacterData_replaceData_error_001.phpt19
-rw-r--r--ext/dom/tests/DOMComment_construct_error_001.phpt17
-rw-r--r--ext/dom/tests/DOMDocumentFragment_appendXML_basic_001.phpt22
-rw-r--r--ext/dom/tests/DOMDocumentFragment_appendXML_error_001.phpt14
-rw-r--r--ext/dom/tests/DOMDocumentFragment_construct_basic_001.phpt15
-rw-r--r--ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt17
11 files changed, 204 insertions, 0 deletions
diff --git a/ext/dom/tests/DOMCharacterData_appendData_error_001.phpt b/ext/dom/tests/DOMCharacterData_appendData_error_001.phpt
new file mode 100644
index 0000000000..4126f99141
--- /dev/null
+++ b/ext/dom/tests/DOMCharacterData_appendData_error_001.phpt
@@ -0,0 +1,19 @@
+--TEST--
+DOMCharacterData::appendData() with no arguments.
+--CREDITS--
+Eric Stewart <ericleestewart@gmail.com>
+# TestFest Atlanta 2009-05-24
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$document = new DOMDocument;
+$root = $document->createElement('root');
+$document->appendChild($root);
+
+$cdata = $document->createCDATASection('test');
+$root->appendChild($cdata);
+$cdata->appendData();
+?>
+--EXPECTF--
+Warning: DOMCharacterData::appendData() expects exactly 1 parameter, 0 given in %s on line %d \ No newline at end of file
diff --git a/ext/dom/tests/DOMCharacterData_deleteData_basic_001.phpt b/ext/dom/tests/DOMCharacterData_deleteData_basic_001.phpt
new file mode 100644
index 0000000000..ad104f1eef
--- /dev/null
+++ b/ext/dom/tests/DOMCharacterData_deleteData_basic_001.phpt
@@ -0,0 +1,20 @@
+--TEST--
+DOMCharacterData::deleteData() with count exceeding string size.
+--CREDITS--
+Eric Lee Stewart <ericleestewart@gmail.com>
+# TestFest Atlanta 2009-05-24
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$document = new DOMDocument;
+$root = $document->createElement('root');
+$document->appendChild($root);
+
+$cdata = $document->createCDATASection('test');
+$root->appendChild($cdata);
+$cdata->deleteData(1, 10);
+var_dump($cdata->data);
+?>
+--EXPECTF--
+%unicode|string%(%d) "t" \ No newline at end of file
diff --git a/ext/dom/tests/DOMCharacterData_deleteData_error_001.phpt b/ext/dom/tests/DOMCharacterData_deleteData_error_001.phpt
new file mode 100644
index 0000000000..3fa7fba2db
--- /dev/null
+++ b/ext/dom/tests/DOMCharacterData_deleteData_error_001.phpt
@@ -0,0 +1,19 @@
+--TEST--
+DOMCharacterData::deleteData() with no arguments.
+--CREDITS--
+Eric Lee Stewart <ericleestewart@gmail.com>
+# TestFest Atlanta 2009-05-24
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$document = new DOMDocument;
+$root = $document->createElement('root');
+$document->appendChild($root);
+
+$cdata = $document->createCDATASection('test');
+$root->appendChild($cdata);
+$cdata->deleteData();
+?>
+--EXPECTF--
+Warning: DOMCharacterData::deleteData() expects exactly 2 parameters, 0 given in %s on line %d \ No newline at end of file
diff --git a/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt b/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
new file mode 100644
index 0000000000..117d5de24e
--- /dev/null
+++ b/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
@@ -0,0 +1,23 @@
+--TEST--
+DOMCharacterData::deleteData() with offset exceeding string size.
+--CREDITS--
+Eric Lee Stewart <ericleestewart@gmail.com>
+# TestFest Atlanta 2009-05-24
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$document = new DOMDocument;
+$root = $document->createElement('root');
+$document->appendChild($root);
+
+$cdata = $document->createCDATASection('test');
+$root->appendChild($cdata);
+$cdata->deleteData(5, 1);
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'DOMException' with message 'Index Size Error' in %s:%d
+Stack trace:
+#0 %s(%d): DOMCharacterData->deleteData(5, 1)
+#1 {main}
+ thrown in %s on line %d \ No newline at end of file
diff --git a/ext/dom/tests/DOMCharacterData_insertData_error_001.phpt b/ext/dom/tests/DOMCharacterData_insertData_error_001.phpt
new file mode 100644
index 0000000000..813a0be52a
--- /dev/null
+++ b/ext/dom/tests/DOMCharacterData_insertData_error_001.phpt
@@ -0,0 +1,19 @@
+--TEST--
+DOMCharacterData::insertData() with no arguments.
+--CREDITS--
+Eric Lee Stewart <ericleestewart@gmail.com>
+# TestFest Atlanta 2009-05-24
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$document = new DOMDocument;
+$root = $document->createElement('root');
+$document->appendChild($root);
+
+$cdata = $document->createCDATASection('test');
+$root->appendChild($cdata);
+$cdata->insertData();
+?>
+--EXPECTF--
+Warning: DOMCharacterData::insertData() expects exactly 2 parameters, 0 given in %s on line %d \ No newline at end of file
diff --git a/ext/dom/tests/DOMCharacterData_replaceData_error_001.phpt b/ext/dom/tests/DOMCharacterData_replaceData_error_001.phpt
new file mode 100644
index 0000000000..45d25dd859
--- /dev/null
+++ b/ext/dom/tests/DOMCharacterData_replaceData_error_001.phpt
@@ -0,0 +1,19 @@
+--TEST--
+DOMCharacterData::replaceData() with no arguments.
+--CREDITS--
+Eric Lee Stewart <ericleestewart@gmail.com>
+# TestFest Atlanta 2009-05-24
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$document = new DOMDocument;
+$root = $document->createElement('root');
+$document->appendChild($root);
+
+$cdata = $document->createCDATASection('test');
+$root->appendChild($cdata);
+$cdata->replaceData();
+?>
+--EXPECTF--
+Warning: DOMCharacterData::replaceData() expects exactly 3 parameters, 0 given in %s on line %d \ No newline at end of file
diff --git a/ext/dom/tests/DOMComment_construct_error_001.phpt b/ext/dom/tests/DOMComment_construct_error_001.phpt
new file mode 100644
index 0000000000..89142fe6f6
--- /dev/null
+++ b/ext/dom/tests/DOMComment_construct_error_001.phpt
@@ -0,0 +1,17 @@
+--TEST--
+DOMComment::__construct() with more arguments than acceptable.
+--CREDITS--
+Eric Lee Stewart <ericleestewart@gmail.com>
+# TestFest Atlanta 2009-05-24
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$comment = new DOMComment("comment1", "comment2");
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'DOMException' with message 'DOMComment::__construct() expects at most 1 parameter, 2 given' in %s:%d
+Stack trace:
+#0 %s(%d): DOMComment->__construct('comment1', 'comment2')
+#1 {main}
+ thrown in %s on line %d \ No newline at end of file
diff --git a/ext/dom/tests/DOMDocumentFragment_appendXML_basic_001.phpt b/ext/dom/tests/DOMDocumentFragment_appendXML_basic_001.phpt
new file mode 100644
index 0000000000..a6f381be05
--- /dev/null
+++ b/ext/dom/tests/DOMDocumentFragment_appendXML_basic_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+DOMDocumentFragment::appendXML() with children with properties.
+--CREDITS--
+Eric Lee Stewart <ericleestewart@gmail.com>
+# TestFest Atlanta 2009-05-24
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$document = new DOMDocument;
+$root = $document->createElement('root');
+$document->appendChild($root);
+
+$fragment = $document->createDocumentFragment();
+$fragment->appendXML('<foo id="baz">bar</foo>');
+$root->appendChild($fragment);
+
+print $document->saveXML();
+?>
+--EXPECT--
+<?xml version="1.0"?>
+<root><foo id="baz">bar</foo></root>
diff --git a/ext/dom/tests/DOMDocumentFragment_appendXML_error_001.phpt b/ext/dom/tests/DOMDocumentFragment_appendXML_error_001.phpt
new file mode 100644
index 0000000000..6ffe510b0d
--- /dev/null
+++ b/ext/dom/tests/DOMDocumentFragment_appendXML_error_001.phpt
@@ -0,0 +1,14 @@
+--TEST--
+DOMDocumentFragment::appendXML() with no arguments.
+--CREDITS--
+Eric Lee Stewart <ericleestewart@gmail.com>
+# TestFest Atlanta 2009-05-24
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$fragment = new DOMDocumentFragment();
+$fragment->appendXML();
+?>
+--EXPECTF--
+Warning: DOMDocumentFragment::appendXML() expects exactly 1 parameter, 0 given in %s on line %d \ No newline at end of file
diff --git a/ext/dom/tests/DOMDocumentFragment_construct_basic_001.phpt b/ext/dom/tests/DOMDocumentFragment_construct_basic_001.phpt
new file mode 100644
index 0000000000..6021bac0bb
--- /dev/null
+++ b/ext/dom/tests/DOMDocumentFragment_construct_basic_001.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DOMDocumentFragment::__construct().
+--CREDITS--
+Eric Lee Stewart <ericleestewart@gmail.com>
+# TestFest Atlanta 2009-05-24
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$fragment = new DOMDocumentFragment();
+var_dump($fragment);
+?>
+--EXPECTF--
+object(DOMDocumentFragment)#%d (%d) {
+}
diff --git a/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt b/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt
new file mode 100644
index 0000000000..91173c4b7c
--- /dev/null
+++ b/ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt
@@ -0,0 +1,17 @@
+--TEST--
+DOMDocumentFragment::__construct() with too many errors.
+--CREDITS--
+Eric Lee Stewart <ericleestewart@gmail.com>
+# TestFest Atlanta 2009-05-24
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$fragment = new DOMDocumentFragment("root");
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'DOMException' with message 'DOMDocumentFragment::__construct() expects exactly 0 parameters, 1 given' in %s:%d
+Stack trace:
+#0 %s(%d): DOMDocumentFragment->__construct('root')
+#1 {main}
+ thrown in %s on line %d \ No newline at end of file