summaryrefslogtreecommitdiffstats
path: root/tests/014-stream.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/014-stream.phpt')
-rw-r--r--tests/014-stream.phpt34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/014-stream.phpt b/tests/014-stream.phpt
new file mode 100644
index 0000000..5a4fefa
--- /dev/null
+++ b/tests/014-stream.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Check for stream
+--SKIPIF--
+<?php if (!extension_loaded("rpminfo")) print "skip"; ?>
+--FILE--
+<?php
+$n = "rpm://" . __DIR__ . "/bidon.rpm#/usr/share/doc/bidon/README";
+
+var_dump(in_array('rpm', stream_get_wrappers()));
+
+var_dump($f = fopen($n, "r"));
+var_dump(trim(fread($f, 10)));
+var_dump(feof($f));
+var_dump(trim(fread($f, 100)));
+var_dump(feof($f));
+fclose($f);
+
+var_dump(trim(file_get_contents($n)));
+
+var_dump(file_get_contents(str_replace('README', 'TODO', $n)));
+?>
+Done
+--EXPECTF--
+bool(true)
+resource(%d) of type (stream)
+string(10) "Mon Feb 12"
+bool(false)
+string(17) "13:27:47 CET 2018"
+bool(true)
+string(28) "Mon Feb 12 13:27:47 CET 2018"
+
+Warning: file_get_contents(%s/bidon.rpm#/usr/share/doc/bidon/TODO): Failed to open stream: operation failed in %s on line %d
+bool(false)
+Done