Files
Enelix-EMS/tests/VerbraucherBasisTraitTest.php
T
2026-09-10 08:03:05 +00:00

99 lines
2.5 KiB
PHP

<?php
declare(strict_types=1);
namespace Belevo\EnelixEMS\Tests;
use Belevo\EnelixEMS\VerbraucherBasisTrait;
use PHPUnit\Framework\TestCase;
final class VerbraucherBasisTraitTest extends TestCase
{
public function testGemeinsamePropertiesUndVariablenWerdenRegistriert(): void
{
$modul = new VerbraucherBasisDummy();
$modul->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<string, mixed> */
public array $properties = [];
/** @var array<string, string> */
public array $variablen = [];
/** @var list<string> */
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;
}
}