@@ -266,7 +266,6 @@ class SettingsTest extends TestCase
266266 ],
267267 'maxRowPlotLimit ' => 500 ,
268268 'ShowGitRevision ' => true ,
269- 'MysqlMinVersion ' => ['internal ' => 50500 , 'human ' => '5.5.0 ' ],
270269 'DisableShortcutKeys ' => false ,
271270 'Console ' => null ,
272271 'DefaultTransformations ' => null ,
@@ -553,7 +552,6 @@ public static function providerForTestConstructor(): array
553552 ['DefaultFunctions ' , null , ['FUNC_CHAR ' => '' , 'FUNC_DATE ' => '' , 'FUNC_NUMBER ' => '' , 'FUNC_SPATIAL ' => 'GeomFromText ' , 'FUNC_UUID ' => 'UUID ' , 'first_timestamp ' => 'NOW ' ]],
554553 ['maxRowPlotLimit ' , null , 500 ],
555554 ['ShowGitRevision ' , null , true ],
556- ['MysqlMinVersion ' , null , ['internal ' => 50500 , 'human ' => '5.5.0 ' ]],
557555 ['DisableShortcutKeys ' , null , false ],
558556 ['Console ' , null , null ],
559557 ['DefaultTransformations ' , null , null ],
@@ -748,7 +746,6 @@ public static function providerForTestConstructor(): array
748746 ['DefaultFunctions ' , ['key ' => 'value ' , 'key2 ' => 'value2 ' ], ['key ' => 'value ' , 'key2 ' => 'value2 ' ]],
749747 ['maxRowPlotLimit ' , 1 , 1 ],
750748 ['ShowGitRevision ' , false , false ],
751- ['MysqlMinVersion ' , ['internal ' => 80026 , 'human ' => '8.0.26 ' ], ['internal ' => 80026 , 'human ' => '8.0.26 ' ]],
752749 ['DisableShortcutKeys ' , true , true ],
753750 ['Console ' , [], null ],
754751 ['DefaultTransformations ' , [], null ],
@@ -786,7 +783,6 @@ public static function providerForTestConstructor(): array
786783 ['SendErrorReports ' , 'ask ' , 'ask ' ],
787784 ['environment ' , 'production ' , 'production ' ],
788785 ['DefaultFunctions ' , [], []],
789- ['MysqlMinVersion ' , [], ['internal ' => 50500 , 'human ' => '5.5.0 ' ]],
790786 ['FirstDayOfCalendar ' , 0 , 0 ],
791787 ],
792788 ],
@@ -1038,7 +1034,6 @@ public static function providerForTestConstructor(): array
10381034 ['DefaultFunctions ' , ['test ' => 1234 ], ['test ' => '1234 ' ]],
10391035 ['maxRowPlotLimit ' , '1 ' , 1 ],
10401036 ['ShowGitRevision ' , 0 , false ],
1041- ['MysqlMinVersion ' , ['internal ' => '50500 ' , 'human ' => 550 ], ['internal ' => 50500 , 'human ' => '550 ' ]],
10421037 ['DisableShortcutKeys ' , 1 , true ],
10431038 ['FirstDayOfCalendar ' , '1 ' , 1 ],
10441039 ],
@@ -1115,7 +1110,6 @@ public static function providerForTestConstructor(): array
11151110 ['environment ' , 'invalid ' , 'production ' ],
11161111 ['DefaultFunctions ' , 'invalid ' , ['FUNC_CHAR ' => '' , 'FUNC_DATE ' => '' , 'FUNC_NUMBER ' => '' , 'FUNC_SPATIAL ' => 'GeomFromText ' , 'FUNC_UUID ' => 'UUID ' , 'first_timestamp ' => 'NOW ' ]],
11171112 ['maxRowPlotLimit ' , 0 , 500 ],
1118- ['MysqlMinVersion ' , 'invalid ' , ['internal ' => 50500 , 'human ' => '5.5.0 ' ]],
11191113 ['Console ' , 'invalid ' , null ],
11201114 ['FirstDayOfCalendar ' , 8 , 0 ],
11211115 ],
@@ -1139,4 +1133,36 @@ public static function providerForTestConstructor(): array
11391133 'invalid values 4 ' => [[['ForeignKeyDropdownOrder ' , [1 => 'content-id ' ], ['content-id ' , 'id-content ' ]]]],
11401134 ];
11411135 }
1136+
1137+ /**
1138+ * @param array{internal: int, human: string} $expected
1139+ *
1140+ * @dataProvider valuesForMysqlMinVersionProvider
1141+ */
1142+ public function testMysqlMinVersion (mixed $ actual , array $ expected ): void
1143+ {
1144+ $ settings = new Settings (['MysqlMinVersion ' => $ actual ]);
1145+ $ settingsArray = $ settings ->asArray ();
1146+ $ this ->assertSame ($ expected , $ settings ->mysqlMinVersion );
1147+ $ this ->assertArrayHasKey ('MysqlMinVersion ' , $ settingsArray );
1148+ $ this ->assertSame ($ expected , $ settingsArray ['MysqlMinVersion ' ]);
1149+ }
1150+
1151+ /** @return iterable<string, array{mixed, array{internal: int, human: string}}> */
1152+ public static function valuesForMysqlMinVersionProvider (): iterable
1153+ {
1154+ yield 'null value ' => [null , ['internal ' => 50500 , 'human ' => '5.5.0 ' ]];
1155+ yield 'valid value ' => [
1156+ ['internal ' => 80026 , 'human ' => '8.0.26 ' ],
1157+ ['internal ' => 80026 , 'human ' => '8.0.26 ' ],
1158+ ];
1159+
1160+ yield 'valid value 2 ' => [[], ['internal ' => 50500 , 'human ' => '5.5.0 ' ]];
1161+ yield 'valid value with type coercion ' => [
1162+ ['internal ' => '50500 ' , 'human ' => 550 ],
1163+ ['internal ' => 50500 , 'human ' => '550 ' ],
1164+ ];
1165+
1166+ yield 'invalid value ' => ['invalid ' , ['internal ' => 50500 , 'human ' => '5.5.0 ' ]];
1167+ }
11421168}
0 commit comments