From dcd310498d56905f5f1b2cf979521da682826699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=A4fliger?= Date: Thu, 10 Sep 2026 08:03:05 +0000 Subject: [PATCH] Entwurf: tests/VerbraucherBasisTraitTest.php --- tests/VerbraucherBasisTraitTest.php | 98 +++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 tests/VerbraucherBasisTraitTest.php diff --git a/tests/VerbraucherBasisTraitTest.php b/tests/VerbraucherBasisTraitTest.php new file mode 100644 index 0000000..2786789 --- /dev/null +++ b/tests/VerbraucherBasisTraitTest.php @@ -0,0 +1,98 @@ +registriere(); + + self::assertSame( + [ + 'PrioritaetPV', + 'PrioritaetPeak', + 'Meldeintervall', + 'VorgabeTimeout', + 'EinstellungenInVisu', + 'LoggingEin', + ], + array_keys($modul->properties) + ); + self::assertSame( + [ + 'Aktiv', + 'Istleistung', + 'Leistungsquelle', + 'Sollleistung', + 'SollwertGueltig', + 'Verfuegbar', + 'AenderungMoeglich', + 'Stoerung', + 'Stoertext', + ], + array_keys($modul->variablen) + ); + self::assertSame(['Aktiv'], $modul->aktionen); + } +} + +final class VerbraucherBasisDummy +{ + use VerbraucherBasisTrait; + + /** @var array */ + public array $properties = []; + + /** @var array */ + public array $variablen = []; + + /** @var list */ + public array $aktionen = []; + + public function registriere(): void + { + $this->registriereVerbraucherBasis(); + } + + public function RegisterPropertyInteger(string $ident, int $standard): void + { + $this->properties[$ident] = $standard; + } + + public function RegisterPropertyBoolean(string $ident, bool $standard): void + { + $this->properties[$ident] = $standard; + } + + public function RegisterVariableBoolean(string $ident, string $name, string $profil, int $position): void + { + $this->variablen[$ident] = 'Boolean'; + } + + public function RegisterVariableFloat(string $ident, string $name, string $profil, int $position): void + { + $this->variablen[$ident] = 'Float'; + } + + public function RegisterVariableInteger(string $ident, string $name, string $profil, int $position): void + { + $this->variablen[$ident] = 'Integer'; + } + + public function RegisterVariableString(string $ident, string $name, string $profil, int $position): void + { + $this->variablen[$ident] = 'String'; + } + + public function EnableAction(string $ident): void + { + $this->aktionen[] = $ident; + } +}