diff --git a/tests/functional/TSIGKeysTest.php b/tests/functional/TSIGKeysTest.php new file mode 100644 index 0000000..083b235 --- /dev/null +++ b/tests/functional/TSIGKeysTest.php @@ -0,0 +1,54 @@ +powerdns->tsigkeys(); + $resource = new TSIGKeyResource(); + + $resource->setName($name); + $resource->setAlgorithm(TSIGKeyAlgorithms::HMAC_SHA512); + + $key = $manager->create($resource); + + $this->assertSame(1, $key->count()); + + $created = $key->offsetGet(0); + $this->assertNotEquals("", $created->getKey()); + + // cleanup + $manager->delete($created); + + } + + public function testCreateWithNonUrlFriendlyName(): void { + $name = "this/is/not/aa-_412'aur\\asd-url-friendly"; + + $manager = $this->powerdns->tsigkeys(); + $resource = new TSIGKeyResource(); + + $resource->setName($name); + $resource->setAlgorithm(TSIGKeyAlgorithms::HMAC_SHA512); + + $key = $manager->create($resource); + + $this->assertSame(1, $key->count()); + + $created = $key->offsetGet(0); + $this->assertNotEquals("", $created->getKey()); + + // cleanup + $manager->delete($created); + } + +}