Verbrauchermodule und betriebsartabhängige Angebote ergänzen
Tests / test (push) Successful in 42s

This commit is contained in:
dh
2026-09-21 18:46:17 +00:00
parent 7b6d1b2f07
commit 3c71626b5f
46 changed files with 4513 additions and 311 deletions
@@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
namespace Belevo\EnelixEMS\Tests;
use PHPUnit\Framework\TestCase;
final class LadestationStandAloneModulstrukturTest extends TestCase
{
private const MODULPFAD = __DIR__ . '/../LadestationStandAlone/';
public function testModulIstVollstaendigUndMetadatenSindGueltig(): void
{
foreach (['module.json', 'form.json', 'module.php'] as $datei) {
self::assertFileExists(self::MODULPFAD . $datei);
}
$modul = json_decode(
(string) file_get_contents(self::MODULPFAD . 'module.json'),
true,
512,
JSON_THROW_ON_ERROR
);
self::assertSame('LadestationStandAlone', $modul['name']);
self::assertSame('8.0', json_decode(
(string) file_get_contents(__DIR__ . '/../library.json'),
true,
512,
JSON_THROW_ON_ERROR
)['compatibility']['version']);
}
public function testGemeinsamerVerbrauchervertragWirdVerwendet(): void
{
$modul = (string) file_get_contents(self::MODULPFAD . 'module.php');
self::assertStringContainsString('implements VerbraucherSchnittstelle', $modul);
self::assertStringContainsString('use VerbraucherBasisTrait;', $modul);
self::assertStringContainsString('ManagerdatenEmpfangen(array $daten)', $modul);
self::assertStringContainsString('Nachrichtenvertrag::pruefeVerbraucherdaten', $modul);
self::assertStringNotContainsString("RegisterVariableString('PowerSteps'", $modul);
}
public function testAlleDreiStandAloneGeraeteUndSichereZugangsdatenSindKonfiguriert(): void
{
$form = json_decode(
(string) file_get_contents(self::MODULPFAD . 'form.json'),
true,
512,
JSON_THROW_ON_ERROR
);
$json = json_encode($form, JSON_THROW_ON_ERROR);
self::assertStringContainsString('go-e Charger (alte API)', $json);
self::assertStringContainsString('go-e Charger Gemini', $json);
self::assertStringContainsString('Gemini flex', $json);
self::assertStringContainsString('smart-me Pico', $json);
self::assertStringContainsString('PasswordTextBox', $json);
self::assertStringNotContainsString('Testmodus', $json);
}
public function testVisualisierungsbuttonsLoggingUndDiagnoseSindVorhanden(): void
{
$modul = (string) file_get_contents(self::MODULPFAD . 'module.php');
self::assertStringContainsString("EnableAction('Ladefreigabe')", $modul);
self::assertStringContainsString("EnableAction('Solarladen')", $modul);
self::assertStringContainsString("ReadPropertyBoolean('LoggingEin')", $modul);
self::assertStringContainsString("ReadPropertyBoolean('EinstellungenInVisu')", $modul);
self::assertStringContainsString('UnregisterVariable($ident)', $modul);
}
}