]> granicus.if.org Git - php/commitdiff
fixed tests
authorZoe Slattery <zoe@php.net>
Thu, 22 Jan 2009 22:01:04 +0000 (22:01 +0000)
committerZoe Slattery <zoe@php.net>
Thu, 22 Jan 2009 22:01:04 +0000 (22:01 +0000)
ext/standard/tests/file/fopen_variation12.phpt
ext/standard/tests/file/fopen_variation16.phpt

index 54a1fa93e9ef212da3c6f36cefb6d11e27d52043..9df4490236fdafcb1b6111cae613d27f2ae88ff0 100644 (file)
@@ -1,7 +1,5 @@
 --TEST--
 Test fopen() function : variation: use include path (path is bad) create a file (relative)
---XFAIL--
-Pending completion of Unicode streams
 --CREDITS--
 Dave Kelsey <d_kelsey@uk.ibm.com>
 --FILE--
@@ -12,16 +10,15 @@ Dave Kelsey <d_kelsey@uk.ibm.com>
  * Alias to functions: 
  */
 
-echo "*** Testing fopen() : variation ***\n";
 set_include_path("rubbish");
 testme();
 restore_include_path();
 
 
 function testme() {
-       $tmpfile = 'fopen_variation12.tmp';
+       $tmpfile = basename(__FILE__, ".php") . ".tmp"; 
        $h = fopen($tmpfile, "w", true);
-       fwrite($h, "This is the test file");
+       fwrite($h, (binary) "This is the test file");
        fclose($h);
        
        
@@ -35,8 +32,9 @@ function testme() {
           unlink($tmpfile);
        }
        
+
        $scriptDirFile = dirname(__FILE__).'/'.$tmpfile; 
-       $h = fopen($scriptDirFile, "r");
+       $h = @fopen($scriptDirFile, "r");
        if ($h === false) {
           echo "Not created in script dir\n";
        }
@@ -49,7 +47,6 @@ function testme() {
 ?>
 ===DONE===
 --EXPECT--
-*** Testing fopen() : variation ***
-Not created in working dir
-created in script dir
+created in working dir
+Not created in script dir
 ===DONE===
index 059098ff577d7c1271910d27f7e9217de18ed2ef..3f220aa7c02c87d34829aaac5e25c50d549fbe4c 100644 (file)
@@ -2,8 +2,6 @@
 Test fopen() function : variation: use include path create and read a file (relative)
 --CREDITS--
 Dave Kelsey <d_kelsey@uk.ibm.com>
---XFAIL--
-Bug #46680
 --FILE--
 <?php
 /* Prototype  : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
@@ -14,7 +12,6 @@ Bug #46680
 
 require_once('fopen_include_path.inc');
 
-echo "*** Testing fopen() : variation ***\n";
 $thisTestDir = "fopenVariation16.dir";
 mkdir($thisTestDir);
 chdir($thisTestDir);
@@ -22,6 +19,7 @@ chdir($thisTestDir);
 $newpath = create_include_path();
 set_include_path($newpath);
 runtest();
+
 $newpath = generate_next_path();
 set_include_path($newpath);
 runtest();
@@ -37,13 +35,15 @@ function runtest() {
     $extraDir = "extraDir";
 
     mkdir($dir1.'/'.$extraDir);
+    mkdir($extraDir);
     
        $tmpfile = $extraDir.'/fopen_variation16.tmp';
+
        $h = fopen($tmpfile, "w+", true);
-       fwrite($h, "This is the test file");
+       fwrite($h, (binary) "This is the test file");
        fclose($h);
        
-       $h = fopen($dir1.'/'.$tmpfile, "r");
+       $h = @fopen($dir1.'/'.$tmpfile, "r");
        if ($h === false) {
           echo "Not created in dir1\n";
        }
@@ -57,19 +57,19 @@ function runtest() {
           echo "could not find file for reading\n";
        }
        else {
-          echo "found file again in dir1\n";
+          echo "found file - not in dir1\n";
           fclose($h);
        }
        
-       unlink($dir1.'/'.$tmpfile);   
+       unlink($tmpfile);   
     rmdir($dir1.'/'.$extraDir);        
+    rmdir($extraDir);  
 }
 ?>
 ===DONE===
 --EXPECT--
-*** Testing fopen() : variation ***
-created in dir1
-found file again in dir1
-created in dir1
-found file again in dir1
+Not created in dir1
+found file - not in dir1
+Not created in dir1
+found file - not in dir1
 ===DONE===