feat(manager): use overall Energy Pie balance with SDL
Tests / test (push) Successful in 1m3s

This commit is contained in:
dh
2026-10-08 09:40:14 +00:00
parent 86834bb8aa
commit af69151165
4 changed files with 82 additions and 2 deletions
+38
View File
@@ -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'];