From f13562aa66b28a381f4fdaf31db026cfa04d8c54 Mon Sep 17 00:00:00 2001 From: Josie Messa Date: Tue, 26 Feb 2008 09:34:28 +0000 Subject: [PATCH] - New tests for chdir() function --- ext/standard/tests/array/chdir_basic.phpt | 53 ++++ ext/standard/tests/array/chdir_error1.phpt | 39 +++ ext/standard/tests/array/chdir_error2.phpt | 26 ++ .../tests/array/chdir_variation1.phpt | 235 ++++++++++++++++++ .../tests/array/chdir_variation2.phpt | 104 ++++++++ ext/standard/tests/dir/chdir_basic.phpt | 53 ++++ ext/standard/tests/dir/chdir_error1.phpt | 39 +++ ext/standard/tests/dir/chdir_error2.phpt | 26 ++ ext/standard/tests/dir/chdir_variation1.phpt | 235 ++++++++++++++++++ ext/standard/tests/dir/chdir_variation2.phpt | 104 ++++++++ 10 files changed, 914 insertions(+) create mode 100644 ext/standard/tests/array/chdir_basic.phpt create mode 100644 ext/standard/tests/array/chdir_error1.phpt create mode 100644 ext/standard/tests/array/chdir_error2.phpt create mode 100644 ext/standard/tests/array/chdir_variation1.phpt create mode 100644 ext/standard/tests/array/chdir_variation2.phpt create mode 100644 ext/standard/tests/dir/chdir_basic.phpt create mode 100644 ext/standard/tests/dir/chdir_error1.phpt create mode 100644 ext/standard/tests/dir/chdir_error2.phpt create mode 100644 ext/standard/tests/dir/chdir_variation1.phpt create mode 100644 ext/standard/tests/dir/chdir_variation2.phpt diff --git a/ext/standard/tests/array/chdir_basic.phpt b/ext/standard/tests/array/chdir_basic.phpt new file mode 100644 index 0000000000..5fc0e5b886 --- /dev/null +++ b/ext/standard/tests/array/chdir_basic.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test chdir() function : basic functionality +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing chdir() : basic functionality *** + +-- Testing chdir() with absolute path: -- +bool(true) +string(%d) "%slevel_one" + +-- Testing chdir() with relative paths: -- +bool(true) +string(%d) "%slevel_one%elevel_two" +===DONE=== diff --git a/ext/standard/tests/array/chdir_error1.phpt b/ext/standard/tests/array/chdir_error1.phpt new file mode 100644 index 0000000000..0f57ff5b2a --- /dev/null +++ b/ext/standard/tests/array/chdir_error1.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test chdir() function : error conditions - Incorrect number of arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing chdir() : error conditions *** + +-- Testing chdir() function with Zero arguments -- + +Warning: chdir() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing chdir() function with more than expected no. of arguments -- + +Warning: chdir() expects exactly 1 parameter, 2 given in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/array/chdir_error2.phpt b/ext/standard/tests/array/chdir_error2.phpt new file mode 100644 index 0000000000..a3bbb63e6d --- /dev/null +++ b/ext/standard/tests/array/chdir_error2.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test chdir() function : error conditions - Non-existent directory +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing chdir() : error conditions *** + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/array/chdir_variation1.phpt b/ext/standard/tests/array/chdir_variation1.phpt new file mode 100644 index 0000000000..a7cf857f7f --- /dev/null +++ b/ext/standard/tests/array/chdir_variation1.phpt @@ -0,0 +1,235 @@ +--TEST-- +Test chdir() function : usage variations - different data type as $directory arg +--FILE-- +dir_path = $dir; + } + + public function __toString() { + return "$this->dir_path"; + } +} + +// heredoc string +$heredoc = << +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing chdir() : usage variations *** + +-- Iteration 1 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 10 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 17 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 18 -- + +Warning: chdir() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 19 -- +bool(true) + +-- Iteration 20 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 21 -- +bool(true) + +-- Iteration 22 -- +bool(true) + +-- Iteration 23 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 24 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 25 -- + +Warning: chdir() expects parameter 1 to be string, resource given in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/array/chdir_variation2.phpt b/ext/standard/tests/array/chdir_variation2.phpt new file mode 100644 index 0000000000..fa70f9e104 --- /dev/null +++ b/ext/standard/tests/array/chdir_variation2.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test chdir() function : usage variations - relative paths +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing chdir() : usage variations *** + +-- $directory = './level_one': -- +bool(true) +bool(true) +string(%d) "%slevel_one" + +-- $directory = 'level_one/level_two': -- +bool(true) +bool(true) +string(%d) "%slevel_one%elevel_two" + +-- $directory = '..': -- +bool(true) +string(%d) "%slevel_one" + +-- $directory = 'level_two', '.': -- +bool(true) +bool(true) +string(%d) "%slevel_one%elevel_two" + +-- $directory = '../': -- +bool(true) +string(%d) "%slevel_one" + +-- $directory = './': -- +bool(true) +bool(true) +string(%d) "%slevel_one%elevel_two" + +-- $directory = '../../'level_one': -- +bool(true) +bool(true) +string(%d) "%slevel_one" +===DONE=== diff --git a/ext/standard/tests/dir/chdir_basic.phpt b/ext/standard/tests/dir/chdir_basic.phpt new file mode 100644 index 0000000000..5fc0e5b886 --- /dev/null +++ b/ext/standard/tests/dir/chdir_basic.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test chdir() function : basic functionality +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing chdir() : basic functionality *** + +-- Testing chdir() with absolute path: -- +bool(true) +string(%d) "%slevel_one" + +-- Testing chdir() with relative paths: -- +bool(true) +string(%d) "%slevel_one%elevel_two" +===DONE=== diff --git a/ext/standard/tests/dir/chdir_error1.phpt b/ext/standard/tests/dir/chdir_error1.phpt new file mode 100644 index 0000000000..0f57ff5b2a --- /dev/null +++ b/ext/standard/tests/dir/chdir_error1.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test chdir() function : error conditions - Incorrect number of arguments +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing chdir() : error conditions *** + +-- Testing chdir() function with Zero arguments -- + +Warning: chdir() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing chdir() function with more than expected no. of arguments -- + +Warning: chdir() expects exactly 1 parameter, 2 given in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/chdir_error2.phpt b/ext/standard/tests/dir/chdir_error2.phpt new file mode 100644 index 0000000000..a3bbb63e6d --- /dev/null +++ b/ext/standard/tests/dir/chdir_error2.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test chdir() function : error conditions - Non-existent directory +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing chdir() : error conditions *** + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/chdir_variation1.phpt b/ext/standard/tests/dir/chdir_variation1.phpt new file mode 100644 index 0000000000..a7cf857f7f --- /dev/null +++ b/ext/standard/tests/dir/chdir_variation1.phpt @@ -0,0 +1,235 @@ +--TEST-- +Test chdir() function : usage variations - different data type as $directory arg +--FILE-- +dir_path = $dir; + } + + public function __toString() { + return "$this->dir_path"; + } +} + +// heredoc string +$heredoc = << +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing chdir() : usage variations *** + +-- Iteration 1 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 10 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 17 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 18 -- + +Warning: chdir() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 19 -- +bool(true) + +-- Iteration 20 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 21 -- +bool(true) + +-- Iteration 22 -- +bool(true) + +-- Iteration 23 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 24 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 25 -- + +Warning: chdir() expects parameter 1 to be string, resource given in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/chdir_variation2.phpt b/ext/standard/tests/dir/chdir_variation2.phpt new file mode 100644 index 0000000000..fa70f9e104 --- /dev/null +++ b/ext/standard/tests/dir/chdir_variation2.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test chdir() function : usage variations - relative paths +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing chdir() : usage variations *** + +-- $directory = './level_one': -- +bool(true) +bool(true) +string(%d) "%slevel_one" + +-- $directory = 'level_one/level_two': -- +bool(true) +bool(true) +string(%d) "%slevel_one%elevel_two" + +-- $directory = '..': -- +bool(true) +string(%d) "%slevel_one" + +-- $directory = 'level_two', '.': -- +bool(true) +bool(true) +string(%d) "%slevel_one%elevel_two" + +-- $directory = '../': -- +bool(true) +string(%d) "%slevel_one" + +-- $directory = './': -- +bool(true) +bool(true) +string(%d) "%slevel_one%elevel_two" + +-- $directory = '../../'level_one': -- +bool(true) +bool(true) +string(%d) "%slevel_one" +===DONE=== -- 2.40.0