Skip to content

Commit b7ec7b0

Browse files
committed
Really fix tests
1 parent dcfa0c8 commit b7ec7b0

16 files changed

+43
-33
lines changed

ext/pdo/tests/pdo_008.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
1616
$db = PDOTest::factory();
1717

1818
$db->exec('CREATE TABLE test008(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))');
19-
$db->exec("INSERT INTO test008 VALUES('A', 'A'), ('B', 'A'), ('C', 'C')");
19+
$db->exec("INSERT INTO test008 VALUES('A', 'A')");
20+
$db->exec("INSERT INTO test008 VALUES('B', 'A')");
21+
$db->exec("INSERT INTO test008 VALUES('C', 'C')");
2022

2123
$stmt = $db->prepare('SELECT val, id from test008');
2224

ext/pdo/tests/pdo_test.inc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,21 @@ class PDOTest {
7575
return;
7676
}
7777

78-
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) === "oci") {
79-
$db->exec(<<<SQL
80-
BEGIN
81-
EXECUTE IMMEDIATE 'DROP TABLE $tableName';
82-
EXCEPTION
83-
WHEN OTHERS THEN
84-
IF SQLCODE != -942 THEN
85-
RAISE;
86-
END IF;
78+
match ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
79+
"oci" => $db->exec(<<<SQL
80+
BEGIN
81+
EXECUTE IMMEDIATE 'DROP TABLE $tableName';
82+
EXCEPTION
83+
WHEN OTHERS THEN
84+
IF SQLCODE != -942 THEN
85+
RAISE;
86+
END IF;
8787
END;
88-
SQL
89-
);
90-
} else {
91-
$db->exec("DROP TABLE IF EXISTS $tableName");
92-
}
88+
SQL
89+
),
90+
"firebird" => $db->exec("DROP TABLE $tableName"),
91+
default => $db->exec("DROP TABLE IF EXISTS $tableName"),
92+
};
9393
}
9494
}
9595
?>

ext/pdo_firebird/tests/bug_47415.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ unset($dbh);
3939
--CLEAN--
4040
<?php
4141
require 'testdb.inc';
42-
$dbh->exec("DROP TABLE IF EXISTS test47415");
42+
$dbh->exec("DROP TABLE test47415");
4343
?>
4444
--EXPECT--
4545
bool(false)

ext/pdo_firebird/tests/bug_48877.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ require("testdb.inc");
1414
$value = '2';
1515

1616
$dbh->exec('CREATE TABLE test48877 (A integer)');
17-
$dbh->exec("INSERT INTO test48877 VALUES ('1'), ('2'), ('3')");
17+
$dbh->exec("INSERT INTO test48877 VALUES ('1')");
18+
$dbh->exec("INSERT INTO test48877 VALUES ('2')");
19+
$dbh->exec("INSERT INTO test48877 VALUES ('3')");
1820
$dbh->commit();
1921

2022
$query = "SELECT * FROM test48877 WHERE A = :paramno";
@@ -38,7 +40,7 @@ unset($dbh);
3840
--CLEAN--
3941
<?php
4042
require 'testdb.inc';
41-
$dbh->exec("DROP TABLE IF EXISTS test48877");
43+
$dbh->exec("DROP TABLE test48877");
4244
?>
4345
--EXPECT--
4446
bool(false)

ext/pdo_firebird/tests/bug_53280.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ unset($dbh);
3838
--CLEAN--
3939
<?php
4040
require 'testdb.inc';
41-
$dbh->exec("DROP TABLE IF EXISTS test53280");
41+
$dbh->exec("DROP TABLE test53280");
4242
?>
4343
--EXPECT--
4444
array(1) {

ext/pdo_firebird/tests/bug_62024.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ unset($dbh);
4646
--CLEAN--
4747
<?php
4848
require 'testdb.inc';
49-
$dbh->exec("DROP TABLE IF EXISTS test62024");
49+
$dbh->exec("DROP TABLE test62024");
5050
?>
5151
--EXPECT--
5252
bool(true)

ext/pdo_firebird/tests/bug_64037.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ require("testdb.inc");
1313

1414
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
1515
$dbh->exec("CREATE TABLE test64037 (ID INTEGER NOT NULL, TEXT VARCHAR(10), COST NUMERIC(15, 2))");
16-
$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (1, 'test', -1.0), (2, 'test', -0.99), (3, 'test', -1.01)");
16+
$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (1, 'test', -1.0)");
17+
$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (2, 'test', -0.99)");
18+
$dbh->exec("INSERT INTO test64037 (ID, TEXT, COST) VALUES (3, 'test', -1.01)");
1719

1820
$dbh->commit();
1921

@@ -38,7 +40,7 @@ unset($dbh);
3840
--CLEAN--
3941
<?php
4042
require 'testdb.inc';
41-
$dbh->exec("DROP TABLE IF EXISTS test64037");
43+
$dbh->exec("DROP TABLE test64037");
4244
?>
4345
--EXPECT--
4446
string(5) "-1.00"

ext/pdo_firebird/tests/bug_72583.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ unset($dbh);
2222
--CLEAN--
2323
<?php
2424
require 'testdb.inc';
25-
$dbh->exec("DROP TABLE IF EXISTS test72583");
25+
$dbh->exec("DROP TABLE test72583");
2626
?>
2727
--EXPECT--
2828
integer

ext/pdo_firebird/tests/bug_72931.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ unset($dbh);
2121
--CLEAN--
2222
<?php
2323
require 'testdb.inc';
24-
$dbh->exec("DROP TABLE IF EXISTS test72931");
24+
$dbh->exec("DROP TABLE test72931");
2525
?>
2626
--EXPECT--
2727
1

ext/pdo_firebird/tests/bug_73087.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ echo 'OK';
2828
--CLEAN--
2929
<?php
3030
require 'testdb.inc';
31-
$dbh->exec("DROP TABLE IF EXISTS test73087");
31+
$dbh->exec("DROP TABLE test73087");
3232
?>
3333
--EXPECT--
3434
OK

ext/pdo_firebird/tests/bug_74462.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ LSAN_OPTIONS=detect_leaks=0
1111
require 'testdb.inc';
1212

1313
$dbh->exec('recreate table test74462 (id integer not null, abool boolean)');
14-
$dbh->exec('insert into test74462 (id, abool) values (1, true), (2, false), (3, null)');
14+
$dbh->exec('insert into test74462 (id, abool) values (1, true)');
15+
$dbh->exec('insert into test74462 (id, abool) values (2, false)');
16+
$dbh->exec('insert into test74462 (id, abool) values (3, null)');
1517
$S = $dbh->query('select abool from test74462 order by id');
1618
$D = $S->fetchAll(PDO::FETCH_COLUMN);
1719
unset($S);
@@ -21,7 +23,7 @@ var_dump($D);
2123
--CLEAN--
2224
<?php
2325
require 'testdb.inc';
24-
$dbh->exec("DROP TABLE IF EXISTS test74462");
26+
$dbh->exec("DROP TABLE test74462");
2527
?>
2628
--EXPECT--
2729
array(3) {

ext/pdo_firebird/tests/bug_aaa.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ echo 'OK';
2323
--CLEAN--
2424
<?php
2525
require 'testdb.inc';
26-
$dbh->exec("DROP TABLE IF EXISTS test_aaa");
26+
$dbh->exec("DROP TABLE test_aaa");
2727
?>
2828
--EXPECT--
2929
OK

ext/pdo_firebird/tests/dialect_1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ echo "done\n";
5555
--CLEAN--
5656
<?php
5757
require 'testdb.inc';
58-
$dbh->exec('DROP TABLE IF EXISTS test_dialect_1');
58+
$dbh->exec('DROP TABLE test_dialect_1');
5959
--EXPECT--
6060
int(1)
6161
string(8) "2.000000"

ext/pdo_firebird/tests/execute.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ echo "done\n";
4646
--CLEAN--
4747
<?php
4848
require 'testdb.inc';
49-
$dbh->exec('DROP TABLE IF EXISTS test_execute');
49+
$dbh->exec('DROP TABLE test_execute');
5050
--EXPECT--
5151
bool(true)
5252
int(1)

ext/pdo_firebird/tests/rowCount.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ LSAN_OPTIONS=detect_leaks=0
1212
require("testdb.inc");
1313

1414
$dbh->exec('CREATE TABLE test_rowcount (A VARCHAR(10))');
15-
$dbh->exec("INSERT INTO test_rowcount VALUES ('A'), ('A'), ('B')");
15+
$dbh->exec("INSERT INTO test_rowcount VALUES ('A')");
16+
$dbh->exec("INSERT INTO test_rowcount VALUES ('A')");
17+
$dbh->exec("INSERT INTO test_rowcount VALUES ('B')");
1618
$dbh->commit();
1719

1820
$query = "SELECT * FROM test_rowcount WHERE A = ?";
@@ -42,7 +44,7 @@ unset($dbh);
4244
--CLEAN--
4345
<?php
4446
require 'testdb.inc';
45-
$dbh->exec('DROP TABLE IF EXISTS test_rowcount');
47+
$dbh->exec('DROP TABLE test_rowcount');
4648
--EXPECT--
4749
bool(false)
4850
int(2)

ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ PDOTest::dropTableIfExists($db, test_pdo_oci_attr_autocommit_2");
110110
--EXPECTF--
111111
Test 1 Check beginTransaction insertion
112112
Test 2 Cause an exception and test beginTransaction rollback
113-
Caught expected exception at line 35
113+
Caught expected exception at line 33
114114
SQLSTATE[HY000]: General error: 12899 OCIStmtExecute: ORA-12899: %s
115115
%s
116116
Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction

0 commit comments

Comments
 (0)