From 1ce9261aaced233f3e2638a3ea9199a68ddec2c7 Mon Sep 17 00:00:00 2001 From: Josie Messa Date: Tue, 26 Feb 2008 09:40:49 +0000 Subject: [PATCH] - New tests for chdir() function --- ext/standard/tests/dir/chdir_basic.phpt | 64 ++++ ext/standard/tests/dir/chdir_error1.phpt | 52 +++ ext/standard/tests/dir/chdir_error2.phpt | 32 ++ ext/standard/tests/dir/chdir_variation1.phpt | 361 +++++++++++++++++++ ext/standard/tests/dir/chdir_variation2.phpt | 140 +++++++ 5 files changed, 649 insertions(+) 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/dir/chdir_basic.phpt b/ext/standard/tests/dir/chdir_basic.phpt new file mode 100644 index 0000000000..b78f8b163e --- /dev/null +++ b/ext/standard/tests/dir/chdir_basic.phpt @@ -0,0 +1,64 @@ +--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=== +--UEXPECTF-- +*** Testing chdir() : basic functionality *** + +-- Testing chdir() with absolute path: -- +bool(true) +unicode(%d) "%slevel_one" + +-- Testing chdir() with relative paths: -- +bool(true) +unicode(%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..47951d5ca9 --- /dev/null +++ b/ext/standard/tests/dir/chdir_error1.phpt @@ -0,0 +1,52 @@ +--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 +NULL + +-- Testing chdir() function with more than expected no. of arguments -- + +Warning: chdir() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== +--UEXPECTF-- +*** Testing chdir() : error conditions *** + +-- Testing chdir() function with Zero arguments -- + +Warning: chdir() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing chdir() function with more than expected no. of arguments -- + +Warning: chdir() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===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..2c3afa105f --- /dev/null +++ b/ext/standard/tests/dir/chdir_error2.phpt @@ -0,0 +1,32 @@ +--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=== +--UEXPECTF-- +*** 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..23d46df792 --- /dev/null +++ b/ext/standard/tests/dir/chdir_variation1.phpt @@ -0,0 +1,361 @@ +--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 -- + +Notice: Array to string conversion in %s on line %d + +Warning: chdir(): %s (errno %d) 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(): %s (errno %d) in %s on line %d +bool(false) +===DONE=== +--UEXPECTF-- +*** 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 -- + +Notice: Array to string conversion in %s on line %d + +Warning: chdir(): %s (errno %d) 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(): %s (errno %d) 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..95ef6e6933 --- /dev/null +++ b/ext/standard/tests/dir/chdir_variation2.phpt @@ -0,0 +1,140 @@ +--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=== +--UEXPECTF-- +*** Testing chdir() : usage variations *** + +-- $directory = './level_one': -- +bool(true) +bool(true) +unicode(%d) "%slevel_one" + +-- $directory = 'level_one/level_two': -- +bool(true) +bool(true) +unicode(%d) "%slevel_one%elevel_two" + +-- $directory = '..': -- +bool(true) +unicode(%d) "%slevel_one" + +-- $directory = 'level_two', '.': -- +bool(true) +bool(true) +unicode(%d) "%slevel_one%elevel_two" + +-- $directory = '../': -- +bool(true) +unicode(%d) "%slevel_one" + +-- $directory = './': -- +bool(true) +bool(true) +unicode(%d) "%slevel_one%elevel_two" + +-- $directory = '../../'level_one': -- +bool(true) +bool(true) +unicode(%d) "%slevel_one" +===DONE=== -- 2.50.1