mbeccati                                 Fri, 25 Dec 2009 20:11:07 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=292630

Log:
- Updated pdo_pgsql tests to be 8.5+ friendly

Changed paths:
    U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_33876.phpt
    U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt
    U   php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_44861.phpt
    U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_33876.phpt
    U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_49985.phpt
    U   php/php-src/trunk/ext/pdo/tests/bug_44861.phpt
    U   php/php-src/trunk/ext/pdo_pgsql/tests/bug_33876.phpt
    U   php/php-src/trunk/ext/pdo_pgsql/tests/bug_49985.phpt

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_33876.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_33876.phpt     
2009-12-25 20:09:08 UTC (rev 292629)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_33876.phpt     
2009-12-25 20:11:07 UTC (rev 292630)
@@ -80,10 +80,14 @@

 # Expected to fail; unless told otherwise, PDO assumes string inputs
 # false -> "" as string, which pgsql doesn't like
-if (!$res->execute(array(false)))
-       print_r($res->errorInfo());
-else
+if (!$res->execute(array(false))) {
+       $err = $res->errorInfo();
+       // Strip additional lines ouputted by recent PgSQL versions
+       $err[2] = trim(current(explode("\n", $err[2])));
+       print_r($err);
+} else {
        print_r($res->fetchAll(PDO::FETCH_ASSOC));
+}




Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt     
2009-12-25 20:09:08 UTC (rev 292629)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt     
2009-12-25 20:11:07 UTC (rev 292630)
@@ -22,7 +22,7 @@
         var_dump($stmt->execute(array(1)));
         $db->commit();
     } catch (Exception $e) {
-        echo $e->getMessage()."\n";
+        echo trim(current(explode("\n", $e->getMessage())))."\n";
         $db->rollback();
     }
 }

Modified: php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_44861.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_44861.phpt   2009-12-25 
20:09:08 UTC (rev 292629)
+++ php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_44861.phpt   2009-12-25 
20:11:07 UTC (rev 292630)
@@ -32,7 +32,7 @@
        $from = '';
 }

-$query = "SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 
'row3' $from UNION SELECT 'row4' $from";
+$query = "SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 
'row3' $from UNION SELECT 'row4' $from ORDER BY r";
 $aParams = array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL);

 $res = $db->prepare($query, $aParams);

Modified: php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_33876.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_33876.phpt     
2009-12-25 20:09:08 UTC (rev 292629)
+++ php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_33876.phpt     
2009-12-25 20:11:07 UTC (rev 292630)
@@ -80,10 +80,14 @@

 # Expected to fail; unless told otherwise, PDO assumes string inputs
 # false -> "" as string, which pgsql doesn't like
-if (!$res->execute(array(false)))
-       print_r($res->errorInfo());
-else
+if (!$res->execute(array(false))) {
+       $err = $res->errorInfo();
+       // Strip additional lines ouputted by recent PgSQL versions
+       $err[2] = trim(current(explode("\n", $err[2])));
+       print_r($err);
+} else {
        print_r($res->fetchAll(PDO::FETCH_ASSOC));
+}




Modified: php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_49985.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_49985.phpt     
2009-12-25 20:09:08 UTC (rev 292629)
+++ php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_49985.phpt     
2009-12-25 20:11:07 UTC (rev 292630)
@@ -22,7 +22,7 @@
         var_dump($stmt->execute(array(1)));
         $db->commit();
     } catch (Exception $e) {
-        echo $e->getMessage()."\n";
+        echo trim(current(explode("\n", $e->getMessage())))."\n";
         $db->rollback();
     }
 }

Modified: php/php-src/trunk/ext/pdo/tests/bug_44861.phpt
===================================================================
--- php/php-src/trunk/ext/pdo/tests/bug_44861.phpt      2009-12-25 20:09:08 UTC 
(rev 292629)
+++ php/php-src/trunk/ext/pdo/tests/bug_44861.phpt      2009-12-25 20:11:07 UTC 
(rev 292630)
@@ -32,7 +32,7 @@
        $from = '';
 }

-$query = "SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 
'row3' $from UNION SELECT 'row4' $from";
+$query = "SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 
'row3' $from UNION SELECT 'row4' $from ORDER BY r";
 $aParams = array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL);

 $res = $db->prepare($query, $aParams);

Modified: php/php-src/trunk/ext/pdo_pgsql/tests/bug_33876.phpt
===================================================================
--- php/php-src/trunk/ext/pdo_pgsql/tests/bug_33876.phpt        2009-12-25 
20:09:08 UTC (rev 292629)
+++ php/php-src/trunk/ext/pdo_pgsql/tests/bug_33876.phpt        2009-12-25 
20:11:07 UTC (rev 292630)
@@ -80,10 +80,14 @@

 # Expected to fail; unless told otherwise, PDO assumes string inputs
 # false -> "" as string, which pgsql doesn't like
-if (!$res->execute(array(false)))
-       print_r($res->errorInfo());
-else
+if (!$res->execute(array(false))) {
+       $err = $res->errorInfo();
+       // Strip additional lines ouputted by recent PgSQL versions
+       $err[2] = trim(current(explode("\n", $err[2])));
+       print_r($err);
+} else {
        print_r($res->fetchAll(PDO::FETCH_ASSOC));
+}




Modified: php/php-src/trunk/ext/pdo_pgsql/tests/bug_49985.phpt
===================================================================
--- php/php-src/trunk/ext/pdo_pgsql/tests/bug_49985.phpt        2009-12-25 
20:09:08 UTC (rev 292629)
+++ php/php-src/trunk/ext/pdo_pgsql/tests/bug_49985.phpt        2009-12-25 
20:11:07 UTC (rev 292630)
@@ -22,7 +22,7 @@
         var_dump($stmt->execute(array(1)));
         $db->commit();
     } catch (Exception $e) {
-        echo $e->getMessage()."\n";
+        echo trim(current(explode("\n", $e->getMessage())))."\n";
         $db->rollback();
     }
 }

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

Reply via email to