diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:31:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:31:28 +0000 |
commit | 067008c5f094ba9606daacbe540f6b929dc124ea (patch) | |
tree | 3092ce2cd8bf1ac6db6c97f4c98c7f71a51c6ac8 /test/php/library/X509/Common | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-x509-upstream/1%1.3.2.tar.xz icingaweb2-module-x509-upstream/1%1.3.2.zip |
Adding upstream version 1:1.3.2.upstream/1%1.3.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/php/library/X509/Common')
-rw-r--r-- | test/php/library/X509/Common/JobUtilsTest.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/php/library/X509/Common/JobUtilsTest.php b/test/php/library/X509/Common/JobUtilsTest.php new file mode 100644 index 0000000..9283344 --- /dev/null +++ b/test/php/library/X509/Common/JobUtilsTest.php @@ -0,0 +1,44 @@ +<?php + +/* Icinga Web 2 X.509 Module | (c) 2023 Icinga GmbH | GPLv2 */ + +namespace Tests\Icinga\Modules\X509\Common; + +use Icinga\Module\X509\Common\JobUtils; +use PHPUnit\Framework\TestCase; + +class JobUtilsTest extends TestCase +{ + use JobUtils; + + public function testGetCidrs() + { + $cidrs = $this->parseCIDRs('10.211.55.30/24,127.0.0.1/8,192.168.178.1/28'); + + $this->assertCount(3, $cidrs); + $this->assertCount(2, $cidrs['10.211.55.30/24']); + + $this->assertSame('10.211.55.30', $cidrs['10.211.55.30/24'][0]); + $this->assertSame('24', $cidrs['10.211.55.30/24'][1]); + } + + public function testGetPorts() + { + $ports = $this->parsePorts('5665,3306,6379,8000-9000'); + + $this->assertCount(4, $ports); + $this->assertCount(2, $ports[3]); + + $this->assertSame('8000', $ports[3][0]); + $this->assertSame('9000', $ports[3][1]); + } + + public function testGetExcludes() + { + $excludes = $this->parseExcludes('icinga.com,netways.de'); + + $this->assertCount(2, $excludes); + $this->assertArrayHasKey('icinga.com', $excludes); + $this->assertArrayHasKey('netways.de', $excludes); + } +} |