Skip to content

Commit

Permalink
Adding CLEAN sections and making tests portable between PHP 5 and PHP…
Browse files Browse the repository at this point in the history
… 6 by replacing string(n) with %unicode|string%(n) and similar.
  • Loading branch information
Ulf Wendel committed Nov 4, 2009
1 parent 04448f2 commit 973d7ba
Show file tree
Hide file tree
Showing 82 changed files with 753 additions and 444 deletions.
24 changes: 12 additions & 12 deletions ext/pdo_mysql/tests/bug44327.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@ $db = MySQLPDOTest::factory();
?>
--EXPECTF--
object(PDORow)#%d (2) {
["queryString"]=>
string(17) "SELECT 1 AS "one""
["one"]=>
string(1) "1"
[%u|b%"queryString"]=>
%unicode|string%(17) "SELECT 1 AS "one""
[%u|b%"one"]=>
%unicode|string%(1) "1"
}
string(1) "1"
string(1) "1"
string(17) "SELECT 1 AS "one""
%unicode|string%(1) "1"
%unicode|string%(1) "1"
%unicode|string%(17) "SELECT 1 AS "one""
----------------------------------
object(PDORow)#%d (2) {
["queryString"]=>
string(19) "SELECT id FROM test"
["id"]=>
string(1) "1"
[%u|b%"queryString"]=>
%unicode|string%(19) "SELECT id FROM test"
[%u|b%"id"]=>
%unicode|string%(1) "1"
}
string(19) "SELECT id FROM test"
%unicode|string%(19) "SELECT id FROM test"
----------------------------------

Notice: Trying to get property of non-object in %s on line %d
Expand Down
21 changes: 12 additions & 9 deletions ext/pdo_mysql/tests/bug46292.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,35 @@ if (version_compare(PHP_VERSION, '5.1.0', '<'))
var_dump($stmt->fetch());
var_dump($stmt->fetch());
var_dump($stmt->fetchAll());

$pdoDb->query('DROP TABLE IF EXISTS testz');

?>
--CLEAN--
<?php
require dirname(__FILE__) . '/mysql_pdo_test.inc';
$db = MySQLPDOTest::factory();
$db->exec('DROP TABLE IF EXISTS testz');
?>
--EXPECTF--
bool(true)
myclass::__construct()
object(myclass)#%d (1) {
["value"]=>
string(1) "1"
[%u|b%"value"]=>
%unicode|string%(1) "1"
}
myclass::__construct()
object(myclass2)#%d (1) {
["value"]=>
string(1) "2"
[%u|b%"value"]=>
%unicode|string%(1) "2"
}
myclass::__construct()
array(2) {
[0]=>
object(myclass)#%d (1) {
["value"]=>
[%u|b%"value"]=>
NULL
}
[1]=>
object(stdClass)#%d (1) {
["value"]=>
[%u|b%"value"]=>
NULL
}
}
9 changes: 7 additions & 2 deletions ext/pdo_mysql/tests/bug_33689.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ else

print_r($tmp);
?>
--CLEAN--
<?php
require dirname(__FILE__) . '/mysql_pdo_test.inc';
MySQLPDOTest::dropTestTable();
?>
--EXPECTF--
object(PDOStatement)#%d (1) {
["queryString"]=>
string(18) "SELECT * from test"
[%u|b%"queryString"]=>
%unicode|string%(18) "SELECT * from test"
}
Array
(
Expand Down
1 change: 0 additions & 1 deletion ext/pdo_mysql/tests/bug_37445.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ $db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
$db->setAttribute(PDO :: ATTR_EMULATE_PREPARES, true);
$stmt = $db->prepare("SELECT 1");
$stmt->bindParam(':a', 'b');

?>
--EXPECTF--
Fatal error: Cannot pass parameter 2 by reference in %sbug_37445.php on line %d
22 changes: 14 additions & 8 deletions ext/pdo_mysql/tests/bug_39858.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -62,35 +62,41 @@ bug_39858($db);

print "done!";
?>
--CLEAN--
<?php
require dirname(__FILE__) . '/mysql_pdo_test.inc';
$db = MySQLPDOTest::factory();
$db->exec("DROP PROCEDURE IF EXISTS p");
?>
--EXPECTF--
Emulated Prepared Statements...
array(1) {
[0]=>
array(1) {
["2 * 2"]=>
string(1) "4"
[%u|b%"2 * 2"]=>
%unicode|string%(1) "4"
}
}
array(1) {
[0]=>
array(1) {
["2 * 2"]=>
string(1) "4"
[%u|b%"2 * 2"]=>
%unicode|string%(1) "4"
}
}
Native Prepared Statements...
array(1) {
[0]=>
array(1) {
["2 * 2"]=>
string(1) "4"
[%u|b%"2 * 2"]=>
%unicode|string%(1) "4"
}
}
array(1) {
[0]=>
array(1) {
["2 * 2"]=>
string(1) "4"
[%u|b%"2 * 2"]=>
%unicode|string%(1) "4"
}
}
done!
7 changes: 7 additions & 0 deletions ext/pdo_mysql/tests/bug_41125.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if ($version < 40100)
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
$db = MySQLPDOTest::factory();
$db->exec("DROP TABLE IF EXISTS test");

// And now allow the evil to do his work
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
Expand All @@ -37,6 +38,12 @@ do {

print "done!";
?>
--CLEAN--
<?php
require dirname(__FILE__) . '/mysql_pdo_test.inc';
$db = MySQLPDOTest::factory();
$db->exec("DROP TABLE IF EXISTS test");
?>
--EXPECTF--
Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error in %s on line %d
array(0) {
Expand Down
10 changes: 5 additions & 5 deletions ext/pdo_mysql/tests/bug_41698.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ $stmt = $db->prepare('INSERT INTO test VALUES(?)');
$stmt->execute(array($value));
var_dump($db->query('SELECT * from test')->fetchAll(PDO::FETCH_ASSOC));
?>
--EXPECT--
--EXPECTF--
array(2) {
[0]=>
array(1) {
["floatval"]=>
string(8) "2.340000"
[%u|b%"floatval"]=>
%unicode|string%(8) "2.340000"
}
[1]=>
array(1) {
["floatval"]=>
string(8) "4.560000"
[%u|b%"floatval"]=>
%unicode|string%(8) "4.560000"
}
}
14 changes: 7 additions & 7 deletions ext/pdo_mysql/tests/bug_41997.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
var_dump($stmt->errorInfo());
print "done!";
?>
--EXPECT--
--EXPECTF--
array(1) {
[0]=>
array(1) {
["one"]=>
string(1) "1"
[%u|b%"one"]=>
%unicode|string%(1) "1"
}
}
array(3) {
[0]=>
string(5) "00000"
%unicode|string%(5) "00000"
[1]=>
NULL
[2]=>
Expand All @@ -57,13 +57,13 @@ array(3) {
array(1) {
[0]=>
array(1) {
["two"]=>
string(1) "2"
[%u|b%"two"]=>
%unicode|string%(1) "2"
}
}
array(3) {
[0]=>
string(5) "00000"
%unicode|string%(5) "00000"
[1]=>
NULL
[2]=>
Expand Down
8 changes: 4 additions & 4 deletions ext/pdo_mysql/tests/bug_42499.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ Emulated Prepared Statements...
array(1) {
[0]=>
array(1) {
["_id"]=>
string(1) "a"
[%u|b%"_id"]=>
%unicode|string%(1) "a"
}
}

Expand All @@ -71,8 +71,8 @@ Native Prepared Statements...
array(1) {
[0]=>
array(1) {
["_id"]=>
string(1) "a"
[%u|b%"_id"]=>
%unicode|string%(1) "a"
}
}

Expand Down
8 changes: 7 additions & 1 deletion ext/pdo_mysql/tests/bug_44454.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,15 @@ bug_44454($db);

print "done!";
?>
--CLEAN--
<?php
require dirname(__FILE__) . '/mysql_pdo_test.inc';
$db = MySQLPDOTest::factory();
$db->exec('DROP TABLE IF EXISTS test');
?>
--XFAIL--
For some reason the exception gets thrown at the wrong place
--EXPECT--
--EXPECTF--
Native Prepared Statements
... SELECT has returned 1 row...
... INSERT should fail...
Expand Down
10 changes: 5 additions & 5 deletions ext/pdo_mysql/tests/bug_44707.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bug_44707($db);

print "done!";
?>
--EXPECT--
--EXPECTF--
Native Prepared Statements
bool(false)
bool(false)
Expand All @@ -83,10 +83,10 @@ array(0) {
array(1) {
[0]=>
array(2) {
["id"]=>
string(1) "1"
["mybool"]=>
string(1) "0"
[%u|b%"id"]=>
%unicode|string%(1) "1"
[%u|b%"mybool"]=>
%unicode|string%(1) "0"
}
}
done!
10 changes: 5 additions & 5 deletions ext/pdo_mysql/tests/bug_pecl_12925.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ bug_pecl_1295($db);
$db->exec('DROP TABLE IF EXISTS test');
print "done!";
?>
--EXPECT--
--EXPECTF--
Emulated...
array(1) {
[0]=>
array(1) {
["id"]=>
string(1) "c"
[%u|b%"id"]=>
%unicode|string%(1) "c"
}
}
Native...
array(1) {
[0]=>
array(1) {
["id"]=>
string(1) "c"
[%u|b%"id"]=>
%unicode|string%(1) "c"
}
}
done!
25 changes: 15 additions & 10 deletions ext/pdo_mysql/tests/bug_pecl_7976.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -48,40 +48,45 @@ $db = MySQLPDOTest::factory();
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
bug_pecl_7976($db);

$db->exec('DROP PROCEDURE IF EXISTS p');
print "done!";
?>
--CLEAN--
<?php
require dirname(__FILE__) . '/mysql_pdo_test.inc';
$db = MySQLPDOTest::factory();
$db->exec('DROP PROCEDURE IF EXISTS p');
?>
--XFAIL--
Works with mysqlnd. It is not supported by libmysql. For libmysql is good enough to see no crash.
--EXPECT--
--EXPECTF--
Emulated...
array(1) {
[0]=>
array(1) {
["_one"]=>
string(1) "1"
[%u|b%"_one"]=>
%unicode|string%(1) "1"
}
}
array(1) {
[0]=>
array(1) {
["_one"]=>
string(1) "1"
[%u|b%"_one"]=>
%unicode|string%(1) "1"
}
}
Native...
array(1) {
[0]=>
array(1) {
["_one"]=>
string(1) "1"
[%u|b%"_one"]=>
%unicode|string%(1) "1"
}
}
array(1) {
[0]=>
array(1) {
["_one"]=>
string(1) "1"
[%u|b%"_one"]=>
%unicode|string%(1) "1"
}
}
done!
Loading

0 comments on commit 973d7ba

Please sign in to comment.