Add tests for DOMEntityReference

This commit is contained in:
Fabien Villepinte 2019-10-19 15:42:16 +02:00
parent 26635ed71a
commit 550a2df043
3 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,18 @@
--TEST--
DomDocument::createEntityReference() - DOM_INVALID_CHARACTER_ERR raised if name contains an invalid character
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$objDoc = new DomDocument();
try {
$objDoc->createEntityReference('!');
} catch (DOMException $e) {
var_dump($e->getCode() === DOM_INVALID_CHARACTER_ERR);
echo $e->getMessage();
}
?>
--EXPECT--
bool(true)
Invalid Character Error

View File

@ -0,0 +1,11 @@
--TEST--
DOMEntityReference - read $nodeName property
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$der = new DOMEntityReference('nbsp');
var_dump($der->nodeName);
?>
--EXPECT--
string(4) "nbsp"

View File

@ -0,0 +1,16 @@
--TEST--
DOMEntityReference - DOM_INVALID_CHARACTER_ERR raised if name contains an invalid character
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
try {
new DOMEntityReference('!');
} catch (DOMException $e) {
var_dump($e->getCode() === DOM_INVALID_CHARACTER_ERR);
echo $e->getMessage();
}
?>
--EXPECT--
bool(true)
Invalid Character Error