Add Config\Settings\SqlQueryBox::asArray() method
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
51a20c09fc
commit
afcb4e406d
@ -2610,7 +2610,7 @@ final class Settings
|
||||
$settings = get_object_vars($this);
|
||||
$settings['Console'] = $this->Console->asArray();
|
||||
$settings['DBG'] = $this->DBG->asArray();
|
||||
$settings['SQLQuery'] = get_object_vars($this->SQLQuery);
|
||||
$settings['SQLQuery'] = $this->SQLQuery->asArray();
|
||||
$settings['Export'] = $this->Export->asArray();
|
||||
$settings['Import'] = $this->Import->asArray();
|
||||
$settings['Schema'] = $this->Schema->asArray();
|
||||
|
||||
@ -68,6 +68,17 @@ final class SqlQueryBox
|
||||
$this->Refresh = $this->setRefresh($sqlQueryBox);
|
||||
}
|
||||
|
||||
/** @return array<string, bool> */
|
||||
public function asArray(): array
|
||||
{
|
||||
return [
|
||||
'Edit' => $this->Edit,
|
||||
'Explain' => $this->Explain,
|
||||
'ShowAsPHP' => $this->ShowAsPHP,
|
||||
'Refresh' => $this->Refresh,
|
||||
];
|
||||
}
|
||||
|
||||
/** @param mixed[] $sqlQueryBox */
|
||||
private function setEdit(array $sqlQueryBox): bool
|
||||
{
|
||||
|
||||
@ -861,14 +861,6 @@
|
||||
<code>$maxRowPlotLimit</code>
|
||||
</PossiblyUnusedProperty>
|
||||
</file>
|
||||
<file src="libraries/classes/Config/Settings/SqlQueryBox.php">
|
||||
<PossiblyUnusedProperty>
|
||||
<code>$Edit</code>
|
||||
<code>$Explain</code>
|
||||
<code>$Refresh</code>
|
||||
<code>$ShowAsPHP</code>
|
||||
</PossiblyUnusedProperty>
|
||||
</file>
|
||||
<file src="libraries/classes/Config/Settings/Transformations.php">
|
||||
<PossiblyUnusedProperty>
|
||||
<code>$Bool2Text</code>
|
||||
|
||||
@ -34,9 +34,12 @@ class SqlQueryBoxTest extends TestCase
|
||||
|
||||
$expected = array_merge($this->defaultValues, $expectedValues);
|
||||
$settings = new SqlQueryBox($actualValues);
|
||||
$sqlQueryBoxArray = $settings->asArray();
|
||||
|
||||
foreach (array_keys($expectedValues) as $key) {
|
||||
$this->assertSame($expected[$key], $settings->$key);
|
||||
$this->assertArrayHasKey($key, $sqlQueryBoxArray);
|
||||
$this->assertSame($expected[$key], $sqlQueryBoxArray[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user