xref: /PHP-7.2/ext/standard/tests/filters/basic.phpt (revision 52ee529e)
1--TEST--
2basic stream filter tests
3--FILE--
4<?php
5# vim600:syn=php:
6
7$text = "Hello There!";
8$filters = array("string.rot13", "string.toupper", "string.tolower");
9
10function filter_test($names)
11{
12	$fp = tmpfile();
13	fwrite($fp, $GLOBALS["text"]);
14	rewind($fp);
15	foreach ($names as $name) {
16		echo "filter: $name\n";
17		var_dump(stream_filter_prepend($fp, $name));
18	}
19	var_dump(fgets($fp));
20	fclose($fp);
21}
22
23foreach ($filters as $filter) {
24	filter_test(array($filter));
25}
26
27filter_test(array($filters[0], $filters[1]));
28
29?>
30--EXPECTF--
31filter: string.rot13
32resource(%d) of type (stream filter)
33string(12) "Uryyb Gurer!"
34filter: string.toupper
35resource(%d) of type (stream filter)
36string(12) "HELLO THERE!"
37filter: string.tolower
38resource(%d) of type (stream filter)
39string(12) "hello there!"
40filter: string.rot13
41resource(%d) of type (stream filter)
42filter: string.toupper
43resource(%d) of type (stream filter)
44string(12) "URYYB GURER!"
45