This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Belevo\EnelixEMS\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class EaseeModuleStrukturTest extends TestCase
|
||||
{
|
||||
public function testGatewayUndLadestationSindVollstaendigeModule(): void
|
||||
{
|
||||
foreach (['EaseeGateway', 'LadestationGateway'] as $modul) {
|
||||
foreach (['module.json', 'form.json', 'module.php'] as $datei) {
|
||||
self::assertFileExists(__DIR__ . '/../' . $modul . '/' . $datei);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testDatenSchnittstellenPassenZusammen(): void
|
||||
{
|
||||
$gateway = $this->module('EaseeGateway');
|
||||
$ladestation = $this->module('LadestationGateway');
|
||||
|
||||
self::assertContains(
|
||||
'{7AEF3DF7-DA5B-47C5-BCDC-0110D06DDC04}',
|
||||
$gateway['implemented']
|
||||
);
|
||||
self::assertContains(
|
||||
'{107D5CFA-8F3D-4E38-8643-90DDFE6A3B4D}',
|
||||
$gateway['childRequirements']
|
||||
);
|
||||
self::assertContains(
|
||||
'{7AEF3DF7-DA5B-47C5-BCDC-0110D06DDC04}',
|
||||
$ladestation['parentRequirements']
|
||||
);
|
||||
self::assertContains(
|
||||
'{107D5CFA-8F3D-4E38-8643-90DDFE6A3B4D}',
|
||||
$ladestation['implemented']
|
||||
);
|
||||
}
|
||||
|
||||
public function testZugangsdatenLiegenNurImGateway(): void
|
||||
{
|
||||
$gatewayForm = (string) file_get_contents(
|
||||
__DIR__ . '/../EaseeGateway/form.json'
|
||||
);
|
||||
$ladestationForm = (string) file_get_contents(
|
||||
__DIR__ . '/../LadestationGateway/form.json'
|
||||
);
|
||||
|
||||
self::assertStringContainsString('PasswordTextBox', $gatewayForm);
|
||||
self::assertStringNotContainsString('PasswordTextBox', $ladestationForm);
|
||||
self::assertStringNotContainsString('Username', $ladestationForm);
|
||||
}
|
||||
|
||||
public function testLadestationVerwendetApiStatusUndGemeinsamenVertrag(): void
|
||||
{
|
||||
$modul = (string) file_get_contents(
|
||||
__DIR__ . '/../LadestationGateway/module.php'
|
||||
);
|
||||
|
||||
self::assertStringContainsString('implements VerbraucherSchnittstelle', $modul);
|
||||
self::assertStringContainsString('EaseeLadestatus::ausBeobachtungen', $modul);
|
||||
self::assertStringContainsString("'FahrzeugVerbunden'", $modul);
|
||||
self::assertStringContainsString("'Phasenzahl'", $modul);
|
||||
self::assertStringNotContainsString('7500', $modul);
|
||||
self::assertStringNotContainsString('Abfrageintervall', $modul);
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
private function module(string $name): array
|
||||
{
|
||||
return json_decode(
|
||||
(string) file_get_contents(__DIR__ . '/../' . $name . '/module.json'),
|
||||
true,
|
||||
512,
|
||||
JSON_THROW_ON_ERROR
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user