Commit:    6e4cfa18f768c385e1945fcb4776cf6ad0cecdfc
Author:    Remi Collet <r...@php.net>         Wed, 12 Dec 2012 16:53:18 +0100
Parents:   9c96fe52d95a6674f90dc8efd4e2c054818c96ad
Branches:  PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=6e4cfa18f768c385e1945fcb4776cf6ad0cecdfc

Log:
Really fix test pdo_mysql_class_constants.phpt

- with mysqlnd, constant always present
- with mysqli, check client library version
- without mysqlnd and without mysqli
        skip the test if no connection
        use connection to check client library

Note : MySQLPDOTest::getClientVersion() is broken with mysqlnd
as PDO::ATTR_CLIENT_VERSION return "mysqlnd 5.0.11-dev - 20120503..."
so, getClientVersion() return "11"

Changed paths:
  M  ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt


Diff:
diff --git a/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt 
b/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt
index e52e4b5..ee0f123 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt
@@ -3,6 +3,11 @@ PDO MySQL specific class constants
 --SKIPIF--
 <?php
 require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
+if (!extension_loaded('mysqli') && !extension_loaded('mysqlnd')) {
+       /* Need connection to detect library version */
+       require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 
'mysql_pdo_test.inc');
+       MySQLPDOTest::skip();
+}
 ?>
 --FILE--
 <?php
@@ -29,9 +34,13 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 
'skipif.inc');
                $expected['MYSQL_ATTR_READ_DEFAULT_GROUP']              = true;
        }
 
-       if (extension_loaded('mysqli')
-           && (stristr(mysqli_get_client_info(), "mysqlnd") || 
mysqli_get_client_version() > 50605)
-               || MySQLPDOTest::getClientVersion(MySQLPDOTest::factory()) > 
50605) {
+       if (extension_loaded('mysqlnd')) {
+               $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY']               = true;
+       } else if (extension_loaded('mysqli')) {
+           if (mysqli_get_client_version() > 50605) {
+                       $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY']       = true;
+           }
+       } else if (MySQLPDOTest::getClientVersion(MySQLPDOTest::factory()) > 
50605) {
                /* XXX the MySQL client library version isn't exposed with any 
                constants, the single possibility is to use the 
PDO::getAttribute().
                This however will fail with no connection. */


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

Reply via email to