Tests / test (push) Successful in 1m1s
Approved by Daniel Haefliger for develop and beta. Author dh_Agent, authenticated account dh. Preserve published battery, charging and overall Energy Pie changes. No deployment or plant control authorization.
34 lines
1.4 KiB
PHP
34 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Belevo\EnelixEMS\Tests;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
require_once __DIR__ . '/../libs/NetzfahrplanV4Bezugszaehler.php';
|
|
require_once __DIR__ . '/fixtures/V4BezugszaehlerScenarios.php';
|
|
|
|
final class NetzfahrplanV4BezugszaehlerTest extends TestCase
|
|
{
|
|
public function testReadOnlyCounterSources(): void
|
|
{
|
|
self::assertCount(20, V4BezugszaehlerScenarios::run());
|
|
}
|
|
|
|
public function testNoLegacyMeterOrActuatorFallback(): void
|
|
{
|
|
$source = file_get_contents(__DIR__ . '/../libs/NetzfahrplanV4Bezugszaehler.php');
|
|
foreach (['SetValue(', 'IPS_SetProperty(', 'RequestAction(', 'AC_Set', '53476'] as $forbidden) {
|
|
self::assertStringNotContainsString($forbidden, $source);
|
|
}
|
|
$trait = file_get_contents(__DIR__ . '/../libs/ManagerNetzfahrplanV4Trait.php');
|
|
// The explicitly configured physical import-energy source is now shared;
|
|
// legacy calculated energy archives and power-to-energy guesses are not.
|
|
self::assertStringContainsString("'NetzbezugEnergieVariableID'", $trait);
|
|
self::assertStringContainsString("'FaktorZuKWh' => \$this->ReadPropertyFloat('NetzbezugEnergiefaktor')", $trait);
|
|
self::assertStringNotContainsString("GetValue('NetzbezugEnergie')", $trait);
|
|
self::assertStringContainsString("RegisterPropertyString('NetzfahrplanV4BezugszaehlerQuellen', '[]')", $trait);
|
|
}
|
|
}
|