This commit is contained in:
@@ -413,6 +413,44 @@ final class ManagerSDLTest extends TestCase
|
||||
self::assertSame($custom, ManagerSDLRuntime::$properties[303]);
|
||||
}
|
||||
|
||||
public function testModernEnergyPieUsesOverallBalanceWithAndWithoutSDL(): void
|
||||
{
|
||||
$custom = [
|
||||
'ProduktionZaehlerID' => 801, 'NetzbezugZaehlerID' => 802,
|
||||
'EinspeisungZaehlerID' => 803, 'VerbrauchZaehlerID' => 804,
|
||||
'FarbeEigenverbrauch' => '#123456', 'FarbeAutarkie' => '#ABCDEF',
|
||||
'Standardzeitraum' => 'month', 'EnergieanteileBerechenbar' => false,
|
||||
'Gesamtbilanz' => false,
|
||||
];
|
||||
foreach ([true, false] as $sdl) {
|
||||
ManagerSDLRuntime::$properties[303] = $custom;
|
||||
ManagerSDLRuntime::$hidden[303] = true;
|
||||
$this->properties(['SDLAktiv' => $sdl]);
|
||||
$this->invoke('synchronisiereEnergyPieAnteile', [303]);
|
||||
self::assertSame(array_replace($custom, ['Gesamtbilanz' => true]),
|
||||
ManagerSDLRuntime::$properties[303]);
|
||||
self::assertFalse(ManagerSDLRuntime::$hidden[303]);
|
||||
$writes = ManagerSDLRuntime::$writes;
|
||||
$this->invoke('synchronisiereEnergyPieAnteile', [303]);
|
||||
self::assertSame($writes, ManagerSDLRuntime::$writes);
|
||||
}
|
||||
self::assertSame([], ManagerSDLRuntime::$logs);
|
||||
}
|
||||
|
||||
public function testUtilsUpgradeRestoresBalanceWithoutResettingCustomSources(): void
|
||||
{
|
||||
ManagerSDLRuntime::$properties[303] = ['ProduktionZaehlerID' => 801];
|
||||
$this->properties(['SDLAktiv' => true]);
|
||||
$this->invoke('synchronisiereEnergyPieAnteile', [303]);
|
||||
self::assertTrue(ManagerSDLRuntime::$hidden[303]);
|
||||
ManagerSDLRuntime::$properties[303]['Gesamtbilanz'] = false;
|
||||
ManagerSDLRuntime::$properties[303]['EnergieanteileBerechenbar'] = false;
|
||||
$this->invoke('synchronisiereEnergyPieAnteile', [303]);
|
||||
self::assertFalse(ManagerSDLRuntime::$hidden[303]);
|
||||
self::assertTrue(ManagerSDLRuntime::$properties[303]['Gesamtbilanz']);
|
||||
self::assertSame(801, ManagerSDLRuntime::$properties[303]['ProduktionZaehlerID']);
|
||||
}
|
||||
|
||||
public function testOlderEnergyPieStaysVisibleWithoutSDLAndKeepsConfiguration(): void
|
||||
{
|
||||
$custom = ['ProduktionZaehlerID' => 801, 'FarbeEigenverbrauch' => '#123456'];
|
||||
|
||||
Reference in New Issue
Block a user