Skip to content

Commit c888d69

Browse files
committed
Drop support for MYSQL_TEST_EXPERIMENTAL
This environment variable serves to hide (parts of) tests from general execution, and as the test failures show when that environment variable is set, apparently it serves to hide (parts of) test from being executed at all, thus causing test rot. To avoid this in the future, we drop `MYSQL_TEST_EXPERIMENTAL`, and fix the failing tests, except for mysqli_get_warnings.phpt, which appears to be broken beyond repair, and whose most important tests are already covered by other test cases.
1 parent 7e5171d commit c888d69

File tree

5 files changed

+13
-161
lines changed

5 files changed

+13
-161
lines changed

ext/mysqli/tests/connect.inc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
ini_set('mysqli.default_socket', $socket);
2121
}
2222

23-
/* Development setting: test experimental features and/or feature requests that never worked before? */
24-
$TEST_EXPERIMENTAL = 1 == getenv("MYSQL_TEST_EXPERIMENTAL");
25-
2623
function get_environment_connection_flags(): int {
2724
static $connect_flags = null;
2825
if ($connect_flags === null) {

ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,10 @@ require_once 'skipifconnectfailure.inc';
130130
$mode = mt_rand(-1000, 1000);
131131
} while (in_array($mode, $valid));
132132

133-
if ($TEST_EXPERIMENTAL) {
134-
ob_start();
133+
try {
135134
new mysqli_result($link, $mode);
136-
$content = ob_get_contents();
137-
ob_end_clean();
138-
if (!stristr($content, 'Invalid value for resultmode'))
139-
printf("[009] Expecting warning because of invalid resultmode\n");
140-
}
135+
printf("[009] Expecting ValueError because of invalid resultmode\n");
136+
} catch (ValueError $ex) {}
141137

142138
print "done!";
143139
?>

ext/mysqli/tests/mysqli_get_warnings.phpt

Lines changed: 0 additions & 141 deletions
This file was deleted.

ext/mysqli/tests/mysqli_warning_unclonable.phpt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ mysqli
55
--SKIPIF--
66
<?php
77
require_once 'skipifconnectfailure.inc';
8-
if (!$TEST_EXPERIMENTAL)
9-
die("skip - experimental (= unsupported) feature");
108
?>
119
--FILE--
1210
<?php
@@ -16,17 +14,20 @@ if (!$TEST_EXPERIMENTAL)
1614
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
1715
$host, $user, $db, $port, $socket);
1816

17+
if (!mysqli_query($link, "SET sql_mode=''"))
18+
printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
19+
1920
if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
20-
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
21-
22-
if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
2321
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
2422

25-
if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
23+
if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT NOT NULL)"))
2624
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
2725

26+
if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1), (NULL)"))
27+
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
28+
2829
if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
29-
printf("[006] Expecting object/mysqli_warning, got %s/%s\n", gettype($warning), (is_object($warning) ? var_export($warning, true) : $warning));
30+
printf("[006] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
3031
}
3132

3233
$warning_clone = clone $warning;
@@ -37,4 +38,5 @@ if (!$TEST_EXPERIMENTAL)
3738
require_once 'clean_table.inc';
3839
?>
3940
--EXPECTF--
40-
Fatal error: Trying to clone an uncloneable object of class mysqli_warning in %s on line %d
41+
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli_warning in %s:%d
42+
Stack trace:%A

ext/mysqli/tests/test_setup/test_helpers.inc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,4 @@ function setup_table_with_data_on_default_connection(string $table): mysqli {
142142
return $link;
143143
}
144144

145-
/* Development setting: test experimental features and/or feature requests that never worked before? */
146-
//$TEST_EXPERIMENTAL = 1 == getenv("MYSQL_TEST_EXPERIMENTAL");
147145
//$engine = getenv("MYSQL_TEST_ENGINE") ?: "InnoDB";

0 commit comments

Comments
 (0)