xref: /PHP-7.0/ext/libxml/tests/004.phpt (revision 2f1c4064)
1--TEST--
2libxml_set_streams_context()
3--SKIPIF--
4<?php if (!extension_loaded('dom')) die('skip'); ?>
5--FILE--
6<?php
7
8$ctxs = array(
9	NULL,
10	'bogus',
11	123,
12	new stdclass,
13	array('a'),
14	stream_context_create(),
15	stream_context_create(array('file')),
16	stream_context_create(array('file' => array('some_opt' => 'aaa')))
17);
18
19
20foreach ($ctxs as $ctx) {
21	var_dump(libxml_set_streams_context($ctx));
22	$dom = new DOMDocument();
23	var_dump($dom->load(dirname(__FILE__).'/test.xml'));
24}
25
26echo "Done\n";
27
28?>
29--EXPECTF--
30Warning: stream_context_create(): options should have the form ["wrappername"]["optionname"] = $value in %s004.php on line %d
31
32Warning: libxml_set_streams_context() expects parameter 1 to be resource, null given in %s004.php on line %d
33NULL
34bool(true)
35
36Warning: libxml_set_streams_context() expects parameter 1 to be resource, string given in %s004.php on line %d
37NULL
38bool(true)
39
40Warning: libxml_set_streams_context() expects parameter 1 to be resource, integer given in %s004.php on line %d
41NULL
42bool(true)
43
44Warning: libxml_set_streams_context() expects parameter 1 to be resource, object given in %s004.php on line %d
45NULL
46bool(true)
47
48Warning: libxml_set_streams_context() expects parameter 1 to be resource, array given in %s004.php on line %d
49NULL
50bool(true)
51NULL
52bool(true)
53NULL
54bool(true)
55NULL
56bool(true)
57Done
58