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:
Eric Stewart 2009-05-25 06:03:41 +00:00
parent 00a554b4a3
commit d9c9d4cf4b
11 changed files with 204 additions and 0 deletions

View 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

View 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"

View 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

View 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

View 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

View 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

View 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

View 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>

View 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

View 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) {
}

View 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