Skip to content

Commit 9e61cc3

Browse files
committed
test(process): add process signaler unit coverage
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent a05dac7 commit 9e61cc3

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
6+
* SPDX-License-Identifier: AGPL-3.0-or-later
7+
*/
8+
9+
namespace OCA\Libresign\Tests\Unit\Service\Process;
10+
11+
use OCA\Libresign\Service\Process\ProcessSignaler;
12+
use OCA\Libresign\Tests\Unit\TestCase;
13+
use PHPUnit\Framework\Attributes\DataProvider;
14+
use Psr\Log\LoggerInterface;
15+
16+
class ProcessSignalerTest extends TestCase {
17+
#[DataProvider('provideInvalidPids')]
18+
public function testIsRunningReturnsFalseForInvalidPid(int $pid): void {
19+
$signaler = new ProcessSignaler($this->createMock(LoggerInterface::class));
20+
21+
$this->assertFalse($signaler->isRunning($pid));
22+
}
23+
24+
#[DataProvider('provideInvalidPids')]
25+
public function testStopPidReturnsFalseForInvalidPid(int $pid): void {
26+
$signaler = new ProcessSignaler($this->createMock(LoggerInterface::class));
27+
28+
$this->assertFalse($signaler->stopPid($pid));
29+
}
30+
31+
/**
32+
* @return array<string, array{0: int}>
33+
*/
34+
public static function provideInvalidPids(): array {
35+
return [
36+
'zero' => [0],
37+
'negative' => [-1],
38+
];
39+
}
40+
}

0 commit comments

Comments
 (0)