summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorLars Strojny <lstrojny@php.net>2008-12-20 16:23:37 +0000
committerLars Strojny <lstrojny@php.net>2008-12-20 16:23:37 +0000
commitd2520327a29ad4aa82ae61d346dca27a7a4d65a5 (patch)
tree4f458790a584779a20b8d44b91f278426692090b /ext
parent32ed769056e2b77f4752b2a26fd850d9089e2444 (diff)
downloadphp-git-d2520327a29ad4aa82ae61d346dca27a7a4d65a5.tar.gz
Adding test for stream_resolve_include_path()
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/tests/streams/stream_resolve_include_path.phpt36
1 files changed, 36 insertions, 0 deletions
diff --git a/ext/standard/tests/streams/stream_resolve_include_path.phpt b/ext/standard/tests/streams/stream_resolve_include_path.phpt
new file mode 100644
index 0000000000..2f20ef3aca
--- /dev/null
+++ b/ext/standard/tests/streams/stream_resolve_include_path.phpt
@@ -0,0 +1,36 @@
+--TEST--
+stream_resolve_include_path(string path[, stream context])
+--FILE--
+<?php
+$include_path = __DIR__ . '/test_path';
+$include_path_nested = $include_path . '/nested';
+
+$include_path_file = $include_path . DIRECTORY_SEPARATOR . 'file';
+$include_path_nested_file = $include_path_nested . DIRECTORY_SEPARATOR . 'file';
+
+mkdir($include_path);
+mkdir($include_path_nested);
+
+file_put_contents($include_path_file, 'include_path');
+file_put_contents($include_path_nested_file, 'include_path');
+
+var_dump(stream_resolve_include_path());
+
+set_include_path($include_path . PATH_SEPARATOR . $include_path_nested);
+var_dump(stream_resolve_include_path('file-does-not-exist'));
+
+set_include_path($include_path . PATH_SEPARATOR . $include_path_nested);
+var_dump(stream_resolve_include_path('file'));
+set_include_path($include_path_nested . PATH_SEPARATOR . $include_path);
+var_dump(stream_resolve_include_path('file'));
+
+unlink($include_path_nested_file);
+rmdir($include_path_nested);
+unlink($include_path_file);
+rmdir($include_path);
+--EXPECTF--
+Warning: stream_resolve_include_path() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+bool(false)
+%unicode|string%(%d) "%s/test_path/file"
+%unicode|string%(%d) "%s/test_path/nested/file"