blob: 85a8b6f1a51bd8236f35d7dc0c803200d8487f7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
--TEST--
DOMNode::C14NFile()
--SKIPIF--
<?php
include('skipif.inc');
?>
--FILE--
<?php
$xml = <<< XML
<?xml version="1.0" ?>
<books>
<book>
<title>The Grapes of Wrath</title>
<author>John Steinbeck</author>
</book>
<book>
<title>The Pearl</title>
<author>John Steinbeck</author>
</book>
</books>
XML;
$output = __DIR__.'/DOMNode_C14NFile_basic.tmp';
$doc = new DOMDocument();
$doc->loadXML($xml);
$node = $doc->getElementsByTagName('title')->item(0);
var_dump($node->C14NFile($output));
$content = file_get_contents($output);
var_dump($content);
try {
var_dump($node->C14NFile($output, false, false, []));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump($node->C14NFile($output, false, false, ['query' => []]));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--CLEAN--
<?php
$output = __DIR__.'/DOMNode_C14NFile_basic.tmp';
unlink($output);
?>
--EXPECT--
int(34)
string(34) "<title>The Grapes of Wrath</title>"
DOMNode::C14NFile(): Argument #4 ($xpath) must have a "query" key
DOMNode::C14NFile(): Argument #4 ($xpath) "query" option must be a string, array given
|