]> granicus.if.org Git - php/commitdiff
Revert to the previous version for these tests as they were overwritten by mistake...
authorAnt Phillips <ant@php.net>
Tue, 30 Dec 2008 17:06:50 +0000 (17:06 +0000)
committerAnt Phillips <ant@php.net>
Tue, 30 Dec 2008 17:06:50 +0000 (17:06 +0000)
13 files changed:
ext/standard/tests/array/array_rand_variation4.phpt
ext/standard/tests/array/array_slice_variation1.phpt
ext/standard/tests/array/arsort_variation3.phpt
ext/standard/tests/array/rsort_variation4.phpt
ext/standard/tests/file/006_error.phpt
ext/standard/tests/file/disk.phpt
ext/standard/tests/file/disk_free_space_basic.phpt
ext/standard/tests/file/disk_free_space_error.phpt
ext/standard/tests/file/disk_free_space_variation.phpt
ext/standard/tests/file/disk_total_space_basic.phpt
ext/standard/tests/file/disk_total_space_error.phpt
ext/standard/tests/file/disk_total_space_variation.phpt
ext/standard/tests/file/is_dir_variation2.phpt

index be4302d33f9b22bf9cbf96b1cbfb810f368d2579..9eb7edcd5979fe5d8548837259c0ea97e8b93aa3 100644 (file)
@@ -38,7 +38,7 @@ $asso_arrays = array(
 
        // array with special chars as keys
 /*6*/  array('##' => "key1", '&$r' => 'key2', '!' => "key3", '<>' =>'key4',
-             "NULL" => 'key5', 
+             "NULL" => 'key5', "\n" => 'newline as key',
              "\t" => "tab as key", "'" => 'single quote as key',
              '"' => 'double quote as key', "\0" => "null char as key")
 );
index 4c7a148c88fbdeffd959387a4dc8a830976e9dfc..daed1d84fcfd0ec55c41743026fbb39aaa95980b 100644 (file)
 --TEST--
-Test array_slice() function : usage variations - Pass different data types as $input arg
+Test array_slice() - Third parameter (NULL vs 0)
 --FILE--
 <?php
-/* Prototype  : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
- * Description: Returns elements specified by offset and length 
- * Source code: ext/standard/array.c
- */
 
-/*
- * Pass different arguments as $input argument to array_slice() to test behaviour
- */
+var_dump(array_slice(range(1, 3), 0, NULL, 1));
+var_dump(array_slice(range(1, 3), 0, 0, 1));
+var_dump(array_slice(range(1, 3), 0, NULL));
+var_dump(array_slice(range(1, 3), 0, 0));
 
-echo "*** Testing array_slice() : usage variations ***\n";
+var_dump(array_slice(range(1, 3), -1, 0));
+var_dump(array_slice(range(1, 3), -1, 0, 1));
+var_dump(array_slice(range(1, 3), -1, NULL));
+var_dump(array_slice(range(1, 3), -1, NULL, 1));
 
-// Initialise function arguments not being substituted
-$offset = 2;
 
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
+$a = 'foo';
+var_dump(array_slice(range(1, 3), 0, $a));
+var_dump(array_slice(range(1, 3), 0, $a));
+var_dump($a);
 
-// get a class
-class classA
-{
-  public function __toString() {
-    return "Class A object";
-  }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// unexpected values to be passed to $input argument
-$inputs = array(
-
-       // int data
-/*1*/  0,
-       1,
-       12345,
-       -2345,
-
-       // float data
-/*5*/  10.5,
-       -10.5,
-       12.3456789000e10,
-       12.3456789000E-10,
-       .5,
-
-       // null data
-/*10*/ NULL,
-       null,
-
-       // boolean data
-/*12*/ true,
-       false,
-       TRUE,
-       FALSE,
-       
-       // empty data
-/*16*/ "",
-       '',
-       array(),
-
-       // string data
-/*19*/ "string",
-       'string',
-       $heredoc,
-       
-       // object data
-/*22*/ new classA(),
-
-       // undefined data
-/*23*/ @$undefined_var,
-
-       // unset data
-/*24*/ @$unset_var,
-
-       // resource variable
-/*25*/ $fp
-);
-
-// loop through each element of $inputs to check the behavior of array_slice()
-$iterator = 1;
-foreach($inputs as $input) {
-  echo "\n-- Iteration $iterator --\n";
-  var_dump( array_slice($input, $offset) );
-  $iterator++;
-};
-
-fclose($fp);
-
-echo "Done";
 ?>
 
 --EXPECTF--
-*** Testing array_slice() : usage variations ***
-
--- Iteration 1 --
-
-Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
-NULL
-
--- Iteration 2 --
-
-Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
-NULL
-
--- Iteration 3 --
-
-Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
-NULL
-
--- Iteration 4 --
-
-Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
-NULL
-
--- Iteration 5 --
-
-Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
-NULL
-
--- Iteration 6 --
-
-Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
-NULL
-
--- Iteration 7 --
-
-Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
-NULL
-
--- Iteration 8 --
-
-Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
-NULL
-
--- Iteration 9 --
-
-Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
-NULL
-
--- Iteration 10 --
-
-Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
--- Iteration 11 --
-
-Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
--- Iteration 12 --
-
-Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
-NULL
-
--- Iteration 13 --
-
-Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
-NULL
-
--- Iteration 14 --
-
-Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
-NULL
-
--- Iteration 15 --
-
-Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
-NULL
-
--- Iteration 16 --
-
-Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
--- Iteration 17 --
-
-Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
--- Iteration 18 --
+array(3) {
+  [0]=>
+  int(1)
+  [1]=>
+  int(2)
+  [2]=>
+  int(3)
+}
 array(0) {
 }
-
--- Iteration 19 --
-
-Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
--- Iteration 20 --
-
-Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
--- Iteration 21 --
-
-Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
--- Iteration 22 --
-
-Warning: array_slice() expects parameter 1 to be array, object given in %s on line %d
-NULL
-
--- Iteration 23 --
-
-Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
--- Iteration 24 --
-
-Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
--- Iteration 25 --
-
-Warning: array_slice() expects parameter 1 to be array, resource given in %s on line %d
-NULL
-Done
\ No newline at end of file
+array(3) {
+  [0]=>
+  int(1)
+  [1]=>
+  int(2)
+  [2]=>
+  int(3)
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+  [0]=>
+  int(3)
+}
+array(1) {
+  [2]=>
+  int(3)
+}
+array(0) {
+}
+array(0) {
+}
+string(3) "foo"
index eab3b45f62413082fa3d78c8b56f5dbe9dd528d4..609155ca73baf41a669fd3ba65f5c6f5f8739606 100644 (file)
@@ -1,9 +1,5 @@
 --TEST--
 Test arsort() function : usage variations - sort integer/float values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
 --FILE--
 <?php
 /* Prototype  : bool arsort ( array &$array [, int $sort_flags] )
@@ -63,7 +59,7 @@ foreach ($various_arrays as $array) {
 
 echo "Done\n";
 ?>
---EXPECT--
+--EXPECTF--
 *** Testing arsort() : usage variations ***
 
 -- Testing arsort() by supplying various integer/float arrays --
@@ -277,7 +273,7 @@ array(11) {
 bool(true)
 array(7) {
   [2]=>
-  float(2147483648)
+  %s(2147483648)
   [1]=>
   int(2147483647)
   [6]=>
@@ -287,15 +283,15 @@ array(7) {
   [3]=>
   int(-2147483647)
   [4]=>
-  float(-2147483648)
+  %s(-2147483648)
   [7]=>
-  float(-2147483649)
+  %s(-2147483649)
 }
 - Sort_flag = SORT_REGULAR -
 bool(true)
 array(7) {
   [2]=>
-  float(2147483648)
+  %s(2147483648)
   [1]=>
   int(2147483647)
   [6]=>
@@ -305,15 +301,15 @@ array(7) {
   [3]=>
   int(-2147483647)
   [4]=>
-  float(-2147483648)
+  %s(-2147483648)
   [7]=>
-  float(-2147483649)
+  %s(-2147483649)
 }
 - Sort_flag = SORT_NUMERIC -
 bool(true)
 array(7) {
   [2]=>
-  float(2147483648)
+  %s(2147483648)
   [1]=>
   int(2147483647)
   [6]=>
@@ -323,8 +319,8 @@ array(7) {
   [3]=>
   int(-2147483647)
   [4]=>
-  float(-2147483648)
+  %s(-2147483648)
   [7]=>
-  float(-2147483649)
+  %s(-2147483649)
 }
 Done
\ No newline at end of file
index abbed35badf68b0dd59d8231832e3502957da9ca..4cab1a933402e190726681d837ab17ca26d8d2ff 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 Test rsort() function : usage variations - referenced variables
+--INI--
+allow_call_time_pass_reference=on
 --FILE--
 <?php
 /* Prototype  : bool rsort(array &$array_arg [, int $sort_flags])
@@ -75,4 +77,4 @@ array(3) {
   [2]=>
   &int(33)
 }
-Done
\ No newline at end of file
+Done
index 3cbacd563987e2f2995ea7d1f1627ed46bc3bc86..ac95ca57004355b0d9c10f1fced9a3a970c141b8 100644 (file)
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
 fclose($fp);
 if(fileowner($filename) == 0) {
         unlink ($filename);
-        die('skip...cannot be run as root\n');
+        die('skip cannot be run as root');
 }
 
 unlink($filename);
@@ -68,18 +68,18 @@ unlink( dirname(__FILE__)."/006_error.tmp");
 --EXPECTF--
 *** Testing error conditions for fileperms(), chmod() ***
 
-Warning: chmod(): %s
+Warning: chmod(): %s in %s on line %d
 bool(false)
-%d
+100%d44
 
-Warning: chmod(): %s
+Warning: chmod(): %s in %s on line %d
 bool(false)
-%d
+40755
 
-Warning: chmod(): %s
+Warning: chmod(): No such file or directory in %s on line %d
 bool(false)
 
-Warning: fileperms(): %s
+Warning: fileperms(): stat failed for /no/such/file/dir in %s on line %d
 bool(false)
 
 
index e1a74fc984c039b6fd9add8aa54a31d3b3d868e3..6eef4b4a772a358e1d9b2bba004d89a5068dd86d 100644 (file)
@@ -37,8 +37,8 @@ bool(false)
 
 Warning: disk_total_space(): No such file or directory in %s on line %d
 bool(false)
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 Warning: disk_free_space(): No such file or directory in %s on line %d
 bool(false)
index cae37bad59d37799b52b3763a488301ac944b5b9..d9412198a0dcc561bb1dacd4f60150a43225a1c4 100644 (file)
@@ -50,15 +50,15 @@ rmdir($file_path.$dir);
 
 --EXPECTF--
 *** Testing with existing directory ***
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 *** Testing with newly created directory ***
  
  Free Space before writing to a file
-float(%f)
+float(%d)
 
  Free Space after writing to a file
-float(%f)
+float(%d)
 
  Free Space Value Is Correct
 
index 945b7b9c847b22af452727fcb6f2786c34c9c378..ee5abc8e8a3f28111dc995d7829cee4a168e6d2e 100644 (file)
@@ -55,12 +55,12 @@ NULL
 Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d
 NULL
 
-Warning: disk_free_space(): %s in %s on line %d
+Warning: disk_free_space(): No such file or directory in %s on line %d
 bool(false)
 
-Warning: diskfreespace(): %s in %s on line %d
+Warning: diskfreespace(): No such file or directory in %s on line %d
 bool(false)
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Done --
index 01fa183735b7e1baa0c2392056833dd68ffdac21..ee72eea465a3452b4257eaee6117fcd94be61cd4 100644 (file)
@@ -65,59 +65,59 @@ rmdir($file_path);
 
 --EXPECTF--
 *** Testing disk_free_space() function with a directory ***
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 *** Testing for the return type ***
 bool(true)
 
 *** Testing disk_free_space() function with different styles of file and directory ***
 -- Iteration 1 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Iteration 2 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Iteration 3 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Iteration 4 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Iteration 5 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Iteration 6 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Iteration 7 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Iteration 8 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Iteration 9 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Iteration 10 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Iteration 11 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 -- Iteration 12 --
-float(%f)
-float(%f)
+float(%d)
+float(%d)
 
 --- Done ---
index 8f3a2f21c3dc232e14f4df1e815e235c23417104..caf7452e416a3416bb047eafff3bae6be5f0bb94 100644 (file)
@@ -38,11 +38,11 @@ rmdir($file_path."/disk_total_space");
 
 --EXPECTF--
 *** Testing with existing directory ***
-float(%f)
+float(%d)
 *** Testing with newly created directory ***
-float(%f)
+float(%d)
  
  Total Space after writing to a file
-float(%f)
+float(%d)
 
 --- Done ---
index 196028007ea96dfb62a415c431d2a5f9954a0ffe..4050997e8e4fc2e155cc9c6af6ee3720bb02782c 100644 (file)
@@ -46,6 +46,6 @@ NULL
 
 Warning: disk_total_space(): No such file or directory in %s on line %d
 bool(false)
-float(%f)
+float(%d)
 
 --- Done ---
index 6cd96cd8725d882e0c6c85df2864c7188f5f2f49..f722883a3ca65c039fd437eecd096e6142949da9 100644 (file)
@@ -63,46 +63,46 @@ rmdir($file_path.$dir);
 ?>
 --EXPECTF--
 *** Testing with a directory ***
-float(%f)
+float(%d)
 
 Testing for the return type ***
 bool(true)
 
 *** Testing disk_total_space() function with different directory combinations ***
 -- Iteration 1 --
-float(%f)
+float(%d)
 
 -- Iteration 2 --
-float(%f)
+float(%d)
 
 -- Iteration 3 --
-float(%f)
+float(%d)
 
 -- Iteration 4 --
-float(%f)
+float(%d)
 
 -- Iteration 5 --
-float(%f)
+float(%d)
 
 -- Iteration 6 --
-float(%f)
+float(%d)
 
 -- Iteration 7 --
-float(%f)
+float(%d)
 
 -- Iteration 8 --
-float(%f)
+float(%d)
 
 -- Iteration 9 --
-float(%f)
+float(%d)
 
 -- Iteration 10 --
-float(%f)
+float(%d)
 
 -- Iteration 11 --
-float(%f)
+float(%d)
 
 -- Iteration 12 --
-float(%f)
+float(%d)
 
 --- Done ---
index 881725679328f23d985b76f27c8d92c83a25948e..70fe94e44f7026be859fde556f2301fbf18a78a5 100644 (file)
@@ -70,7 +70,7 @@ bool(true)
 -- With symlink --
 bool(true)
 -- With hardlink --
-Warning: link(): %s
+Warning: link(): %s in %s on line %d
 bool(false)
 
 *** Testing is_dir() with file and links to a file ***