Skip to content

Commit 4b16c62

Browse files
committed
Optimized pdo_mysql tests
1 parent 53218b1 commit 4b16c62

File tree

154 files changed

+657
-779
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+657
-779
lines changed

ext/pdo_mysql/tests/bug41125.phpt

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ Bug #41125 (PDO mysql + quote() + prepare() can result in seg fault)
44
pdo_mysql
55
--SKIPIF--
66
<?php
7-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
88
MySQLPDOTest::skip();
9-
109
?>
1110
--FILE--
1211
<?php
1312

14-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
15-
16-
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
13+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
14+
$db = MySQLPDOTest::factory();
1715

1816
$search = "o'";
1917
$sql = "SELECT 1 FROM DUAL WHERE 'o''riley' LIKE " . $db->quote('%' . $search . '%');
@@ -86,89 +84,89 @@ foreach ($queries as $k => $query) {
8684
?>
8785
--EXPECTF--
8886
1
89-
00000 - -
87+
00000 - -
9088
-------------------------------------------------------
9189

9290
Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in %s on line %d
9391
[1] Query: [[SELECT 1 FROM DUAL WHERE 1 = '?\'\'']]
9492

95-
00000 - -
93+
00000 - -
9694
--------
9795
[2] Query: [[SELECT 'a\'0' FROM DUAL WHERE 1 = ?]]
9896
a'0
99-
00000 - -
97+
00000 - -
10098
--------
10199
[3] Query: [[SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\'' AND ?]]
102100
a - b'
103-
00000 - -
101+
00000 - -
104102
--------
105103
[4] Query: [[SELECT 'foo?bar', '', '''' FROM DUAL WHERE ?]]
106104
foo?bar - - '
107-
00000 - -
105+
00000 - -
108106
--------
109107
Query: [[SELECT upper(:id) FROM DUAL WHERE '1']]
110108
O'\0
111-
00000 - -
109+
00000 - -
112110
-------------------------------------------------------
113111
[1] Query: [[SELECT 1, 'foo' FROM DUAL WHERE 1 = :id AND '\0' IS NULL AND 2 <> :id]]
114112

115-
00000 - -
113+
00000 - -
116114
--------
117115
[2] Query: [[SELECT 1 FROM DUAL WHERE 1 = :id AND '' AND 2 <> :id]]
118116

119-
00000 - -
117+
00000 - -
120118
--------
121119
[3] Query: [[SELECT 1 FROM DUAL WHERE 1 = :id AND '\'\'' = '''' AND 2 <> :id]]
122120

123-
00000 - -
121+
00000 - -
124122
--------
125123
[4] Query: [[SELECT 1 FROM DUAL WHERE 1 = :id AND '\'' = '''' AND 2 <> :id]]
126124
1
127-
00000 - -
125+
00000 - -
128126
--------
129127

130128
Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in %s on line %d
131129
[5] Query: [[SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\'' AND 1]]
132130

133-
00000 - -
131+
00000 - -
134132
--------
135133

136134
Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in %s on line %d
137135
[6] Query: [[SELECT 'a''', '\'b\'' FROM DUAL WHERE '''' LIKE '\'' AND 1]]
138136

139-
00000 - -
137+
00000 - -
140138
--------
141139
[7] Query: [[SELECT UPPER(:id) FROM DUAL WHERE '1']]
142140
1
143-
00000 - -
141+
00000 - -
144142
--------
145143

146144
Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in %s on line %d
147145
[8] Query: [[SELECT 1 FROM DUAL WHERE '\'']]
148146

149-
00000 - -
147+
00000 - -
150148
--------
151149
[9] Query: [[SELECT 1 FROM DUAL WHERE :id AND '\0' OR :id]]
152150
1
153-
00000 - -
151+
00000 - -
154152
--------
155153
[10] Query: [[SELECT 1 FROM DUAL WHERE 'a\f\n\0' AND 1 >= :id]]
156154

157-
00000 - -
155+
00000 - -
158156
--------
159157

160158
Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in %s on line %d
161159
[11] Query: [[SELECT 1 FROM DUAL WHERE '\'' = '''']]
162160

163-
00000 - -
161+
00000 - -
164162
--------
165163

166164
Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in %s on line %d
167165
[12] Query: [[SELECT '\n' '1 FROM DUAL WHERE '''' and :id']]
168166

169-
00000 - -
167+
00000 - -
170168
--------
171169
[13] Query: [[SELECT 1 'FROM DUAL WHERE :id AND '''' = '''' OR 1 = 1 AND ':id]]
172170
1
173-
00000 - -
171+
00000 - -
174172
--------

ext/pdo_mysql/tests/bug44327.phpt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ Bug #44327 (PDORow::queryString property & numeric offsets / Crash)
44
pdo_mysql
55
--SKIPIF--
66
<?php
7-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
88
MySQLPDOTest::skip();
9-
$db = MySQLPDOTest::factory();
109
?>
1110
--FILE--
1211
<?php
13-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
12+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
1413
$db = MySQLPDOTest::factory();
1514
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
1615

@@ -41,6 +40,11 @@ $db = MySQLPDOTest::factory();
4140
$row = $stmt->fetch();
4241
var_dump($row->queryString);
4342

43+
?>
44+
--CLEAN--
45+
<?php
46+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
47+
MySQLPDOTest::dropTestTable();
4448
?>
4549
--EXPECTF--
4650
object(PDORow)#%d (2) {

ext/pdo_mysql/tests/bug46292.phpt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ Bug #46292 (PDO::setFetchMode() shouldn't requires the 2nd arg when using FETCH_
44
pdo_mysql
55
--SKIPIF--
66
<?php
7-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
88
MySQLPDOTest::skip();
99
?>
1010
--FILE--
1111
<?php
1212

13-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
13+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
1414
$pdoDb = MySQLPDOTest::factory();
1515

1616

@@ -27,13 +27,13 @@ MySQLPDOTest::skip();
2727
$pdoDb->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
2828
$pdoDb->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
2929

30-
$pdoDb->query('DROP TABLE IF EXISTS testz');
30+
$pdoDb->query('DROP TABLE IF EXISTS test');
3131

32-
$pdoDb->query('CREATE TABLE testz (name VARCHAR(20) NOT NULL, value INT)');
32+
$pdoDb->query('CREATE TABLE test (name VARCHAR(20) NOT NULL, value INT)');
3333

34-
$pdoDb->query("INSERT INTO testz VALUES ('myclass', 1), ('myclass2', 2), ('myclass', NULL), ('myclass3', NULL)");
34+
$pdoDb->query("INSERT INTO test VALUES ('myclass', 1), ('myclass2', 2), ('myclass', NULL), ('myclass3', NULL)");
3535

36-
$stmt = $pdoDb->prepare("SELECT * FROM testz");
36+
$stmt = $pdoDb->prepare("SELECT * FROM test");
3737

3838
var_dump($stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_CLASSTYPE | PDO::FETCH_GROUP));
3939
$stmt->execute();
@@ -44,9 +44,8 @@ MySQLPDOTest::skip();
4444
?>
4545
--CLEAN--
4646
<?php
47-
require __DIR__ . '/mysql_pdo_test.inc';
48-
$db = MySQLPDOTest::factory();
49-
$db->exec('DROP TABLE IF EXISTS testz');
47+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
48+
MySQLPDOTest::dropTestTable();
5049
?>
5150
--EXPECTF--
5251
bool(true)

ext/pdo_mysql/tests/bug53551.phpt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,25 @@ Bug #44327 (PDORow::queryString property & numeric offsets / Crash)
44
pdo_mysql
55
--SKIPIF--
66
<?php
7-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
88
MySQLPDOTest::skip();
9-
$db = MySQLPDOTest::factory();
109
?>
1110
--FILE--
1211
<?php
13-
include __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
12+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
1413
$db = MySQLPDOTest::factory();
1514

1615
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
1716

18-
$createSql = "CREATE TABLE `bug53551` (
17+
$createSql = "CREATE TABLE `test` (
1918
`count` bigint(20) unsigned NOT NULL DEFAULT '0'
2019
)";
2120

22-
$db->exec('drop table if exists bug53551');
21+
$db->exec('drop table if exists test');
2322
$db->exec($createSql);
24-
$db->exec("insert into bug53551 set `count` = 1 ");
23+
$db->exec("insert into test set `count` = 1 ");
2524
$db->exec("SET sql_mode = 'Traditional'");
26-
$sql = 'UPDATE bug53551 SET `count` = :count';
25+
$sql = 'UPDATE test SET `count` = :count';
2726
$stmt = $db->prepare($sql);
2827

2928
$values = array (
@@ -43,9 +42,8 @@ echo "\ndone\n";
4342
?>
4443
--CLEAN--
4544
<?php
46-
include __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
47-
$db = MySQLPDOTest::factory();
48-
$db->exec('DROP TABLE IF EXISTS bug53551');
45+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
46+
MySQLPDOTest::dropTestTable();
4947
?>
5048
--EXPECTF--
5149
1

ext/pdo_mysql/tests/bug53782.phpt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
--TEST--
22
PDO MySQL Bug #53782 (foreach throws irrelevant exception)
33
--EXTENSIONS--
4-
pdo
54
pdo_mysql
65
--SKIPIF--
76
<?php
8-
require __DIR__ . '/config.inc';
9-
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
10-
PDOTest::skip();
7+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
8+
MySQLPDOTest::skip();
119
?>
1210
--FILE--
1311
<?php
14-
require __DIR__ . '/config.inc';
15-
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
16-
$conn = PDOTest::test_factory(__DIR__ . '/common.phpt');
12+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
13+
$db = MySQLPDOTest::factory();
1714

1815
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
1916

@@ -31,11 +28,6 @@ foreach ($res as $k => $v) {
3128

3229
echo "DONE";
3330
?>
34-
--CLEAN--
35-
<?php
36-
require __DIR__ . '/mysql_pdo_test.inc';
37-
MySQLPDOTest::dropTestTable();
38-
?>
3931
--EXPECTF--
4032
Caught: SQLSTATE[42000]: %s
4133
Value: 0

ext/pdo_mysql/tests/bug54929.phpt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ Bug #54929 (Parse error with single quote in sql comment (pdo-mysql))
44
pdo_mysql
55
--SKIPIF--
66
<?php
7-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
88
MySQLPDOTest::skip();
9-
109
?>
1110
--FILE--
1211
<?php
1312

14-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
15-
16-
$pdodb = PDOTest::test_factory(__DIR__ . '/common.phpt');
13+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
14+
$pdodb = MySQLPDOTest::factory();
1715

1816

1917
function testQuery($query) {

ext/pdo_mysql/tests/bug63176.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bug #63176 (Segmentation fault when instantiate 2 persistent PDO to the same db
44
pdo_mysql
55
--SKIPIF--
66
<?php
7-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
88
MySQLPDOTest::skip();
99
?>
1010
--FILE--
@@ -18,7 +18,6 @@ class PDO3 extends PDO {
1818
protected $tomato;
1919
}
2020

21-
2221
class ModelA {
2322
public $db;
2423
public function __construct($h) {

ext/pdo_mysql/tests/bug63185.phpt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
--TEST--
22
Bug #63185: nextRowset() ignores MySQL errors with native prepared statements
33
--EXTENSIONS--
4-
pdo
54
pdo_mysql
65
--SKIPIF--
76
<?php
8-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
98
MySQLPDOTest::skip();
109
?>
1110
--FILE--
1211
<?php
13-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
12+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
1413

1514
$pdo = MySQLPDOTest::factory();
1615
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@@ -45,7 +44,7 @@ var_dump($st->fetchAll());
4544
?>
4645
--CLEAN--
4746
<?php
48-
require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
47+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
4948
$pdo = MySQLPDOTest::factory();
5049
$pdo->query('DROP PROCEDURE IF EXISTS test_procedure_error_at_second');
5150
?>

ext/pdo_mysql/tests/bug66141.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Bug #66141 (mysqlnd quote function is wrong with NO_BACKSLASH_ESCAPES after fail
44
pdo_mysql
55
--SKIPIF--
66
<?php
7-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
88
MySQLPDOTest::skip();
99
?>
1010
--FILE--
1111
<?php
12-
include __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
12+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
1313
$db = MySQLPDOTest::factory();
1414

1515
$input = 'Something\', 1 as one, 2 as two FROM dual; -- f';

ext/pdo_mysql/tests/bug66528.phpt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
--TEST--
22
Bug #66528: No PDOException or errorCode if database becomes unavailable before PDO::commit
33
--EXTENSIONS--
4-
pdo
54
pdo_mysql
65
--SKIPIF--
76
<?php
8-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
98
MySQLPDOTest::skip();
109
?>
1110
--FILE--
1211
<?php
13-
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
12+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
1413

1514
$dbh = MySQLPDOTest::factory();
1615
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@@ -43,7 +42,7 @@ try {
4342
?>
4443
--CLEAN--
4544
<?php
46-
require __DIR__ . '/mysql_pdo_test.inc';
45+
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
4746
MySQLPDOTest::dropTestTable();
4847
?>
4948
--EXPECT--

0 commit comments

Comments
 (0)