107 lines
4.3 KiB
PHP
107 lines
4.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Belevo\EnelixEMS\Tests;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class DokumentationsstrukturTest extends TestCase
|
|
{
|
|
/** @return list<array{string}> */
|
|
public function modulReadmes(): array
|
|
{
|
|
return [
|
|
['Batterie'],
|
|
['Waermepumpe'],
|
|
];
|
|
}
|
|
|
|
/** @dataProvider modulReadmes */
|
|
public function testJederModulentwurfHatEinReadme(string $modul): void
|
|
{
|
|
$pfad = __DIR__ . '/../docs/module/' . $modul . '/README.md';
|
|
self::assertFileExists($pfad);
|
|
|
|
$inhalt = file_get_contents($pfad);
|
|
self::assertNotFalse($inhalt);
|
|
self::assertStringContainsString('Status: Diskussionsentwurf', $inhalt);
|
|
self::assertStringContainsString('Properties', $inhalt);
|
|
}
|
|
|
|
public function testPufferspeicherDokumentiertDenImplementiertenStand(): void
|
|
{
|
|
$inhalt = file_get_contents(__DIR__ . '/../docs/module/Pufferspeicher/README.md');
|
|
self::assertNotFalse($inhalt);
|
|
self::assertStringContainsString('Status: implementiert', $inhalt);
|
|
self::assertStringContainsString('Managerkommunikation', $inhalt);
|
|
}
|
|
|
|
public function testLadestationStandAloneDokumentiertDenImplementiertenStand(): void
|
|
{
|
|
$inhalt = file_get_contents(__DIR__ . '/../docs/module/Ladestation-Stand-Alone/README.md');
|
|
self::assertNotFalse($inhalt);
|
|
self::assertStringContainsStringIgnoringCase('Status: implementiert', $inhalt);
|
|
self::assertStringContainsString('Properties', $inhalt);
|
|
self::assertStringContainsString('Fake-HTTP-Transport', $inhalt);
|
|
}
|
|
|
|
public function testEaseeModuleDokumentierenDenImplementiertenStand(): void
|
|
{
|
|
foreach (['Easee-Gateway', 'Ladestation-Gateway'] as $modul) {
|
|
$inhalt = file_get_contents(
|
|
__DIR__ . '/../docs/module/' . $modul . '/README.md'
|
|
);
|
|
self::assertNotFalse($inhalt);
|
|
self::assertStringContainsString('Status: implementiert', $inhalt);
|
|
self::assertStringContainsString('Properties', $inhalt);
|
|
self::assertStringContainsString('Tests', $inhalt);
|
|
}
|
|
}
|
|
|
|
public function testSchnittstellenDokumentiertSind(): void
|
|
{
|
|
self::assertFileExists(__DIR__ . '/../docs/Schnittstelle.md');
|
|
self::assertFileExists(__DIR__ . '/../docs/Schnittstelle-Easee-Gateway.md');
|
|
self::assertFileExists(__DIR__ . '/../docs/Obere-Anschluesse.md');
|
|
self::assertFileExists(__DIR__ . '/../libs/VerbraucherBasisTrait.php');
|
|
}
|
|
|
|
public function testManagerDokumentiertDenImplementiertenStand(): void
|
|
{
|
|
$inhalt = file_get_contents(__DIR__ . '/../docs/module/Manager/README.md');
|
|
self::assertNotFalse($inhalt);
|
|
self::assertStringContainsString('Status: Implementiert', $inhalt);
|
|
self::assertStringContainsString('Verteilalgorithmus', $inhalt);
|
|
}
|
|
|
|
public function testVerbraucherEinStufigDokumentiertDenImplementiertenStand(): void
|
|
{
|
|
$detailInhalt = file_get_contents(
|
|
__DIR__ . '/../docs/module/Verbraucher-1-Stufig/README.md'
|
|
);
|
|
self::assertNotFalse($detailInhalt);
|
|
self::assertStringContainsString('Status: implementiert', $detailInhalt);
|
|
self::assertStringContainsString('Umschaltabstand', $detailInhalt);
|
|
self::assertStringContainsString('Installation und Inbetriebnahme', $detailInhalt);
|
|
|
|
$modulInhalt = file_get_contents(__DIR__ . '/../VerbraucherEinStufig/README.md');
|
|
self::assertNotFalse($modulInhalt);
|
|
self::assertStringContainsString('Verhalten ohne separate Rueckmeldung', $modulInhalt);
|
|
self::assertStringContainsString('Mindesteinschaltdauer', $modulInhalt);
|
|
self::assertStringContainsString(
|
|
'composer check:verbraucher-einstufig',
|
|
$modulInhalt
|
|
);
|
|
}
|
|
|
|
public function testWarmwassererwaermerDokumentiertDenImplementiertenStand(): void
|
|
{
|
|
$inhalt = file_get_contents(__DIR__ . '/../docs/module/Wassererwaermer/README.md');
|
|
self::assertNotFalse($inhalt);
|
|
self::assertStringContainsString('Status: implementiert', $inhalt);
|
|
self::assertStringContainsString('Properties', $inhalt);
|
|
self::assertStringContainsString('Managerkommunikation', $inhalt);
|
|
}
|
|
}
|