Skip to content

Commit 550a2df

Browse files
committed
Add tests for DOMEntityReference
1 parent 26635ed commit 550a2df

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
DomDocument::createEntityReference() - DOM_INVALID_CHARACTER_ERR raised if name contains an invalid character
3+
--SKIPIF--
4+
<?php require_once('skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
$objDoc = new DomDocument();
8+
9+
try {
10+
$objDoc->createEntityReference('!');
11+
} catch (DOMException $e) {
12+
var_dump($e->getCode() === DOM_INVALID_CHARACTER_ERR);
13+
echo $e->getMessage();
14+
}
15+
?>
16+
--EXPECT--
17+
bool(true)
18+
Invalid Character Error
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
DOMEntityReference - read $nodeName property
3+
--SKIPIF--
4+
<?php require_once('skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
$der = new DOMEntityReference('nbsp');
8+
var_dump($der->nodeName);
9+
?>
10+
--EXPECT--
11+
string(4) "nbsp"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
DOMEntityReference - DOM_INVALID_CHARACTER_ERR raised if name contains an invalid character
3+
--SKIPIF--
4+
<?php require_once('skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
try {
8+
new DOMEntityReference('!');
9+
} catch (DOMException $e) {
10+
var_dump($e->getCode() === DOM_INVALID_CHARACTER_ERR);
11+
echo $e->getMessage();
12+
}
13+
?>
14+
--EXPECT--
15+
bool(true)
16+
Invalid Character Error

0 commit comments

Comments
 (0)