|
1 | 1 | --TEST--
|
2 |
| -MySQL PDO: PDOStatement->fetchObject() with $constructorArgs |
| 2 | +PDO Common: PDOStatement->fetchObject() with $constructorArgs |
3 | 3 | --EXTENSIONS--
|
4 |
| -pdo_mysql |
| 4 | +pdo |
5 | 5 | --SKIPIF--
|
6 | 6 | <?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(); |
20 | 11 | ?>
|
21 | 12 | --FILE--
|
22 | 13 | <?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(); |
26 | 17 |
|
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')"); |
29 | 23 |
|
30 |
| -$query = "SELECT id FROM {$table} ORDER BY id ASC LIMIT 1"; |
| 24 | +$query = "SELECT id FROM {$table} ORDER BY id ASC"; |
31 | 25 | $stmt = $db->prepare($query);
|
32 | 26 |
|
33 | 27 | class Foo {
|
|
79 | 73 | ?>
|
80 | 74 | --CLEAN--
|
81 | 75 | <?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"); |
85 | 79 | ?>
|
86 | 80 | --EXPECTF--
|
87 | 81 | Too few arguments to function Foo::__construct(), 0 passed and exactly 1 expected
|
|
0 commit comments