summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosie Messa <jmessa@php.net>2008-03-10 15:22:47 +0000
committerJosie Messa <jmessa@php.net>2008-03-10 15:22:47 +0000
commit705435eb9e736635ac5f223f01c3ecd65a761ea0 (patch)
tree725d566879f35368d79eae4e8dae3edeb86574ec
parent1d4f18734f23d87ad593b4fd5653e45b8d9f4c02 (diff)
downloadphp-git-705435eb9e736635ac5f223f01c3ecd65a761ea0.tar.gz
- New tests for getcwd() function
-rw-r--r--ext/standard/tests/dir/getcwd_basic.phpt34
-rw-r--r--ext/standard/tests/dir/getcwd_error.phpt29
2 files changed, 63 insertions, 0 deletions
diff --git a/ext/standard/tests/dir/getcwd_basic.phpt b/ext/standard/tests/dir/getcwd_basic.phpt
new file mode 100644
index 0000000000..ef720d0959
--- /dev/null
+++ b/ext/standard/tests/dir/getcwd_basic.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test getcwd() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed getcwd(void)
+ * Description: Gets the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test basic functionality of getcwd()
+ */
+
+echo "*** Testing getcwd() : basic functionality ***\n";
+
+//create temporary directory for test, removed in CLEAN section
+$directory = dirname(__FILE__) . "/getcwd_basic";
+mkdir($directory);
+
+var_dump(getcwd());
+chdir($directory);
+var_dump(getcwd());
+?>
+===DONE===
+--CLEAN--
+<?php
+$directory = dirname(__FILE__) . "/getcwd_basic";
+rmdir($directory);
+?>
+--EXPECTF--
+*** Testing getcwd() : basic functionality ***
+string(%d) "%s"
+string(%d) "%s%egetcwd_basic"
+===DONE===
diff --git a/ext/standard/tests/dir/getcwd_error.phpt b/ext/standard/tests/dir/getcwd_error.phpt
new file mode 100644
index 0000000000..09ee254819
--- /dev/null
+++ b/ext/standard/tests/dir/getcwd_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test getcwd() function : error conditions - Incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : mixed getcwd(void)
+ * Description: Gets the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass incorrect number of arguments to getcwd() to test behaviour
+ */
+
+echo "*** Testing getcwd() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing getcwd() function with one argument --\n";
+$extra_arg = 10;
+var_dump( getcwd($extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing getcwd() : error conditions ***
+
+-- Testing getcwd() function with one argument --
+
+Warning: Wrong parameter count for getcwd() in %s on line %d
+NULL
+===DONE===