uw              Thu Jul 12 20:04:18 2007 UTC

  Modified files:              
    /php-src/ext/mysqli/tests   connect.inc 
  Log:
  Starting to merge the latest set of ext/mysqli tests from the mysqlnd
  SVN repro into HEAD. Again, it might happen that I crash the set of tests
  and don't mention one or the other change while merging. Blame me...
  
  1) Note the new environment variables to control the test run
  2) Variables $IS_MYSQLND and $MYSQLND_VERSION are for writing portable tests
  3) sys_get_temp_dir function is for PHP5/PHP6 portability
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/connect.inc?r1=1.8&r2=1.9&diff_format=u
Index: php-src/ext/mysqli/tests/connect.inc
diff -u php-src/ext/mysqli/tests/connect.inc:1.8 
php-src/ext/mysqli/tests/connect.inc:1.9
--- php-src/ext/mysqli/tests/connect.inc:1.8    Tue Sep 26 13:06:13 2006
+++ php-src/ext/mysqli/tests/connect.inc        Thu Jul 12 20:04:17 2007
@@ -1,14 +1,54 @@
 <?php
+    /* 
+    Default values are "localhost", "root", 
+    database "phptest" and empty password.     
+    Change the MYSQL_TEST environment values 
+    if you want to use another configuration   
+    */
+     
+       $driver    = new mysqli_driver;
 
-  /* default values are localhost, root and empty password 
-     Change the MYSQL_TEST environment values if you want to 
-     use another configuration   */
-       $driver = new mysqli_driver;
+       $host      = getenv("MYSQL_TEST_HOST")     ? getenv("MYSQL_TEST_HOST") 
: "localhost";
+       $port      = getenv("MYSQL_TEST_PORT")     ? getenv("MYSQL_TEST_PORT") 
: 3306;
+       $user      = getenv("MYSQL_TEST_USER")     ? getenv("MYSQL_TEST_USER") 
: "root";
+       $passwd    = getenv("MYSQL_TEST_PASSWD")   ? 
getenv("MYSQL_TEST_PASSWD") : "";
+       $db        = getenv("MYSQL_TEST_DB")       ? getenv("MYSQL_TEST_DB") : 
"phptest";
+       $engine    = getenv("MYSQL_TEST_ENGINE")   ? 
getenv("MYSQL_TEST_ENGINE") : "MyISAM";
+       $socket    = getenv("MYSQL_TEST_SOCKET")   ? 
getenv("MYSQL_TEST_SOCKET") : null;
+       
+       /* Development setting: test experimal features and/or feature requests 
that never worked before? */
+       $TEST_EXPERIMENTAL = (in_array(getenv("MYSQL_TEST_EXPERIMENTAL"), 
array(0, 1))) ? 
+                            ((1 == getenv("MYSQL_TEST_EXPERIMENTAL")) ? true : 
false) : 
+                             false;
 
-       $host = getenv("MYSQL_TEST_HOST") ? getenv("MYSQL_TEST_HOST") : 
"localhost";
-       $port = getenv("MYSQL_TEST_PORT") ? getenv("MYSQL_TEST_PORT") : 3306;
-       $user = getenv("MYSQL_TEST_USER") ? getenv("MYSQL_TEST_USER") : "root";
-       $passwd = getenv("MYSQL_TEST_PASSWD") ? getenv("MYSQL_TEST_PASSWD") : 
"";
-       $db = getenv("MYSQL_TEST_DB") ? getenv("MYSQL_TEST_DB") : "phptest";
-       $engine = getenv("MYSQL_TEST_ENGINE") ? getenv("MYSQL_TEST_ENGINE") : 
"MyISAM";
-?>
+       $IS_MYSQLND = stristr(mysqli_get_client_info(), "mysqlnd");
+       if (!$IS_MYSQLND) {
+           $MYSQLND_VERSION = NULL;
+       } else {
+           if (preg_match('@Revision:\s+(\d+)[EMAIL PROTECTED]', 
mysqli_get_client_info(), $matches)) {
+               $MYSQLND_VERSION = (int)$matches[1];            
+           } else {
+               $MYSQLND_VERSION = -1;
+           }
+       }
+
+       if (!function_exists('sys_get_temp_dir')) {    
+        function sys_get_temp_dir() {
+        
+            if (!empty($_ENV['TMP']))
+                return realpath( $_ENV['TMP'] );
+            if (!empty($_ENV['TMPDIR']))        
+                return realpath( $_ENV['TMPDIR'] );        
+            if (!empty($_ENV['TEMP']))        
+                return realpath( $_ENV['TEMP'] );
+                        
+            $temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
+            if ($temp_file) {
+                $temp_dir = realpath(dirname($temp_file));
+                unlink($temp_file);
+                return $temp_dir;
+            }
+            return FALSE;            
+        }
+    }
+?>
\ No newline at end of file

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to