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.
33 lines
982 B
PHP
33 lines
982 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Belevo\EnelixEMS\Tests;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class ManagerPrognoseFormularTest extends TestCase
|
|
{
|
|
/** @dataProvider scripts */
|
|
public function testTwoSwitchWorkflow(string $script): void
|
|
{
|
|
$pipes = [];
|
|
$process = proc_open([PHP_BINARY, __DIR__ . '/PrognoseFormular/' . $script],
|
|
[0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes);
|
|
self::assertIsResource($process);
|
|
fclose($pipes[0]);
|
|
$output = stream_get_contents($pipes[1]);
|
|
$errors = stream_get_contents($pipes[2]);
|
|
fclose($pipes[1]);
|
|
fclose($pipes[2]);
|
|
self::assertSame(0, proc_close($process), $output . $errors);
|
|
self::assertSame('', $errors);
|
|
self::assertMatchesRegularExpression('/Total: [0-9]+ checks\./', $output);
|
|
}
|
|
|
|
public function scripts(): array
|
|
{
|
|
return [['checks.php'], ['manager_checks.php']];
|
|
}
|
|
}
|