Merge #16919 - Fix Uncaught TypeError: array_fill(): Argument #2 ($count) must be of type int, string
Pull-request: #16919 Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
commit
8343c28e6c
@ -267,7 +267,8 @@ class InsertEdit
|
|||||||
DatabaseInterface::CONNECT_USER,
|
DatabaseInterface::CONNECT_USER,
|
||||||
DatabaseInterface::QUERY_STORE
|
DatabaseInterface::QUERY_STORE
|
||||||
);
|
);
|
||||||
$rows = array_fill(0, $GLOBALS['cfg']['InsertRows'], false);
|
// Can be a string on some old configuration storage settings
|
||||||
|
$rows = array_fill(0, (int) $GLOBALS['cfg']['InsertRows'], false);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
$result,
|
$result,
|
||||||
|
|||||||
@ -294,12 +294,52 @@ class InsertEditTest extends AbstractTestCase
|
|||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dataProviderConfigValueInsertRows(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
2,
|
||||||
|
[
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'2',
|
||||||
|
[
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
3,
|
||||||
|
[
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'3',
|
||||||
|
[
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for loadFirstRow
|
* Test for loadFirstRow
|
||||||
|
*
|
||||||
|
* @param string|int $configValue
|
||||||
|
*
|
||||||
|
* @dataProvider dataProviderConfigValueInsertRows
|
||||||
*/
|
*/
|
||||||
public function testLoadFirstRow(): void
|
public function testLoadFirstRow($configValue, array $rowsValue): void
|
||||||
{
|
{
|
||||||
$GLOBALS['cfg']['InsertRows'] = 2;
|
$GLOBALS['cfg']['InsertRows'] = $configValue;
|
||||||
|
|
||||||
$dbi = $this->getMockBuilder(DatabaseInterface::class)
|
$dbi = $this->getMockBuilder(DatabaseInterface::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
@ -327,10 +367,7 @@ class InsertEditTest extends AbstractTestCase
|
|||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
[
|
[
|
||||||
'result1',
|
'result1',
|
||||||
[
|
$rowsValue,
|
||||||
false,
|
|
||||||
false,
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
$result
|
$result
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user