Skip to content

Commit 576f5fa

Browse files
committed
ext/pdo: Move PDO MySQL test to common
1 parent 3a039e3 commit 576f5fa

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject_ctor_args.phpt renamed to ext/pdo/tests/pdo_stmt_fetchobject_ctor_args.phpt

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
--TEST--
2-
MySQL PDO: PDOStatement->fetchObject() with $constructorArgs
2+
PDO Common: PDOStatement->fetchObject() with $constructorArgs
33
--EXTENSIONS--
4-
pdo_mysql
4+
pdo
55
--SKIPIF--
66
<?php
7-
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
8-
MySQLPDOTest::skip();
9-
$db = MySQLPDOTest::factory();
10-
11-
try {
12-
$query = "SELECT '', NULL, \"\" FROM DUAL";
13-
$stmt = $db->prepare($query);
14-
$ok = $stmt->execute();
15-
} catch (PDOException $e) {
16-
die("skip: Test cannot be run with SQL mode ANSI");
17-
}
18-
if (!$ok)
19-
die("skip: Test cannot be run with SQL mode ANSI");
7+
$dir = getenv('REDIR_TEST_DIR');
8+
if (false == $dir) die('skip no driver');
9+
require_once $dir . 'pdo_test.inc';
10+
PDOTest::skip();
2011
?>
2112
--FILE--
2213
<?php
23-
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
24-
/** @var PDO $db */
25-
$db = MySQLPDOTest::factory();
14+
if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/');
15+
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
16+
$db = PDOTest::factory();
2617

27-
$table = 'pdo_mysql_stmt_fetchobject_ctor_args';
28-
MySQLPDOTest::createTestTable($table, $db);
18+
$table = 'pdo_stmt_fetchobject_ctor_args';
19+
$db->exec("CREATE TABLE {$table} (id INT, label CHAR(1), PRIMARY KEY(id))");
20+
$db->exec("INSERT INTO {$table} (id, label) VALUES (1, 'a')");
21+
$db->exec("INSERT INTO {$table} (id, label) VALUES (2, 'b')");
22+
$db->exec("INSERT INTO {$table} (id, label) VALUES (3, 'c')");
2923

30-
$query = "SELECT id FROM {$table} ORDER BY id ASC LIMIT 1";
24+
$query = "SELECT id FROM {$table} ORDER BY id ASC";
3125
$stmt = $db->prepare($query);
3226

3327
class Foo {
@@ -79,9 +73,9 @@ try {
7973
?>
8074
--CLEAN--
8175
<?php
82-
require_once __DIR__ . '/inc/mysql_pdo_test.inc';
83-
$db = MySQLPDOTest::factory();
84-
$db->exec('DROP TABLE IF EXISTS pdo_mysql_stmt_fetchobject_ctor_args');
76+
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
77+
$db = PDOTest::factory();
78+
PDOTest::dropTableIfExists($db, "pdo_stmt_fetchobject_ctor_args");
8579
?>
8680
--EXPECTF--
8781
Too few arguments to function Foo::__construct(), 0 passed and exactly 1 expected

0 commit comments

Comments
 (0)