mirror of
https://github.com/php/php-src.git
synced 2025-01-26 21:54:16 +08:00
Add tests for DOMEntityReference
This commit is contained in:
parent
26635ed71a
commit
550a2df043
18
ext/dom/tests/DOMDocument_createEntityReference_error1.phpt
Normal file
18
ext/dom/tests/DOMDocument_createEntityReference_error1.phpt
Normal 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
|
11
ext/dom/tests/DOMEntityReference_basic.phpt
Normal file
11
ext/dom/tests/DOMEntityReference_basic.phpt
Normal 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"
|
16
ext/dom/tests/DOMEntityReference_error1.phpt
Normal file
16
ext/dom/tests/DOMEntityReference_error1.phpt
Normal 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
|
Loading…
Reference in New Issue
Block a user