File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
tests/php/Unit/Service/Process Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments