Skip to content

Commit 7fa2dbf

Browse files
cmb69kamil-tekiela
andauthored
Drop support for MYSQL_TEST_EXPERIMENTAL (GH-15467)
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. Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent 8c704ab commit 7fa2dbf

File tree

5 files changed

+13
-159
lines changed

5 files changed

+13
-159
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: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +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");
135+
} catch (ValueError $ex) {
136+
echo $ex->getMessage(), "\n";
140137
}
141138

142139
print "done!";
@@ -169,4 +166,5 @@ mysqli_result->unknown = ''
169166

170167
Constructor:
171168
mysqli_result object is already closed
169+
mysqli_result::__construct(): Argument #2 ($result_mode) must be either MYSQLI_STORE_RESULT or MYSQLI_USE_RESULT
172170
done!

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: 9 additions & 7 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,15 +14,18 @@ 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)) {
2930
printf("[006] Expecting object/mysqli_warning, got %s/%s\n", gettype($warning), (is_object($warning) ? var_export($warning, true) : $warning));
3031
}
@@ -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)