Commit:    743c4864eb5c868a96d66180a562a00133861385
Author:    Anatol Belski <a...@php.net>         Tue, 2 Jul 2013 08:23:33 +0200
Parents:   06418aca285945253a5f558781c8151cd161327c
Branches:  PHP-5.4 PHP-5.5 master

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

Log:
Fixed mysql tests parsing phpinfo()

Changed paths:
  M  ext/pdo_mysql/tests/mysql_pdo_test.inc
  M  ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt


Diff:
diff --git a/ext/pdo_mysql/tests/mysql_pdo_test.inc 
b/ext/pdo_mysql/tests/mysql_pdo_test.inc
index 115aead..7a97bb4 100644
--- a/ext/pdo_mysql/tests/mysql_pdo_test.inc
+++ b/ext/pdo_mysql/tests/mysql_pdo_test.inc
@@ -162,8 +162,8 @@ class MySQLPDOTest extends PDOTest {
                        phpinfo();
                        $tmp = ob_get_contents();
                        ob_end_clean();
-                       $tmp = stristr($tmp, "PDO Driver for MySQL => enabled");
-                       return (bool)preg_match('/Client API 
version.*mysqlnd/', $tmp);
+                       return (preg_match('/PDO Driver for MySQL.*enabled/', 
$tmp) &&
+                               preg_match('/Client API version.*mysqlnd/', 
$tmp));
        }
 
        static function dropTestTable($db = NULL) {
@@ -174,4 +174,4 @@ class MySQLPDOTest extends PDOTest {
        }
 
 }
-?>
\ No newline at end of file
+?>
diff --git a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt 
b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt
index a570c1f..9674e85 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt
@@ -18,10 +18,9 @@ $db = MySQLPDOTest::factory();
        ob_end_clean();
 
        /*      PDO Driver for MySQL, client library version => 6.0.3-alpha     
*/
-       $expected = sprintf('Client API version => %s',
-               $db->getAttribute(PDO::ATTR_CLIENT_VERSION));
+       $reg = 'Client API version.*' . 
pcre_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/');
 
-       if (false === stristr($tmp, $expected)) {
+       if (!preg_match("/$reg/", $tmp)) {
                printf("[001] Cannot find MySQL PDO driver line in phpinfo() 
output\n");
        }


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

Reply via email to