mirror of
https://github.com/php/php-src.git
synced 2024-11-25 19:05:31 +08:00
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.
This commit is contained in:
parent
00a554b4a3
commit
d9c9d4cf4b
19
ext/dom/tests/DOMCharacterData_appendData_error_001.phpt
Normal file
19
ext/dom/tests/DOMCharacterData_appendData_error_001.phpt
Normal file
@ -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
|
20
ext/dom/tests/DOMCharacterData_deleteData_basic_001.phpt
Normal file
20
ext/dom/tests/DOMCharacterData_deleteData_basic_001.phpt
Normal file
@ -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"
|
19
ext/dom/tests/DOMCharacterData_deleteData_error_001.phpt
Normal file
19
ext/dom/tests/DOMCharacterData_deleteData_error_001.phpt
Normal file
@ -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
|
23
ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
Normal file
23
ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
Normal file
@ -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
|
19
ext/dom/tests/DOMCharacterData_insertData_error_001.phpt
Normal file
19
ext/dom/tests/DOMCharacterData_insertData_error_001.phpt
Normal file
@ -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
|
19
ext/dom/tests/DOMCharacterData_replaceData_error_001.phpt
Normal file
19
ext/dom/tests/DOMCharacterData_replaceData_error_001.phpt
Normal file
@ -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
|
17
ext/dom/tests/DOMComment_construct_error_001.phpt
Normal file
17
ext/dom/tests/DOMComment_construct_error_001.phpt
Normal file
@ -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
|
22
ext/dom/tests/DOMDocumentFragment_appendXML_basic_001.phpt
Normal file
22
ext/dom/tests/DOMDocumentFragment_appendXML_basic_001.phpt
Normal file
@ -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>
|
14
ext/dom/tests/DOMDocumentFragment_appendXML_error_001.phpt
Normal file
14
ext/dom/tests/DOMDocumentFragment_appendXML_error_001.phpt
Normal file
@ -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
|
15
ext/dom/tests/DOMDocumentFragment_construct_basic_001.phpt
Normal file
15
ext/dom/tests/DOMDocumentFragment_construct_basic_001.phpt
Normal file
@ -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) {
|
||||
}
|
17
ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt
Normal file
17
ext/dom/tests/DOMDocumentFragment_construct_error_001.phpt
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user