diff --git a/src/PurplePixie/PhpDns/DNSQuery.php b/src/PurplePixie/PhpDns/DNSQuery.php index bb6cce8..eae2ba2 100644 --- a/src/PurplePixie/PhpDns/DNSQuery.php +++ b/src/PurplePixie/PhpDns/DNSQuery.php @@ -764,6 +764,66 @@ public function getLastnameservers(): DNSAnswer return $this->lastnameservers; } + public function getServer(): string + { + return $this->server; + } + + public function setServer(string $value): void + { + $this->server = $value; + } + + public function getPort(): int + { + return $this->port; + } + + public function setPort(int $value): void + { + $this->port = $value; + } + + public function getTimeout(): int + { + return $this->timeout; + } + + public function setTimeout(int $value): void + { + $this->timeout = $value; + } + + public function getUdp(): bool + { + return $this->udp; + } + + public function setUdp(bool $value): void + { + $this->udp = $value; + } + + public function getDebug(): bool + { + return $this->debug; + } + + public function setDebug(bool $value): void + { + $this->debug = $value; + } + + public function getBinarydebug(): bool + { + return $this->binarydebug; + } + + public function setBinarydebug(bool $value): void + { + $this->binarydebug = $value; + } + public function getLastadditional(): DNSAnswer { return $this->lastadditional; diff --git a/tests/DNSQueryTest.php b/tests/DNSQueryTest.php index 20a4070..ccbbf8c 100644 --- a/tests/DNSQueryTest.php +++ b/tests/DNSQueryTest.php @@ -28,6 +28,32 @@ class DNSQueryTest extends TestCase { + public function testQuerySettingsCanBeReadAndChanged(): void + { + $query = new DNSQuery('initial.server', 53, 60, true, false, false); + + $this->assertSame('initial.server', $query->getServer()); + $this->assertSame(53, $query->getPort()); + $this->assertSame(60, $query->getTimeout()); + $this->assertTrue($query->getUdp()); + $this->assertFalse($query->getDebug()); + $this->assertFalse($query->getBinarydebug()); + + $query->setServer('updated.server'); + $query->setPort(5353); + $query->setTimeout(10); + $query->setUdp(false); + $query->setDebug(true); + $query->setBinarydebug(true); + + $this->assertSame('updated.server', $query->getServer()); + $this->assertSame(5353, $query->getPort()); + $this->assertSame(10, $query->getTimeout()); + $this->assertFalse($query->getUdp()); + $this->assertTrue($query->getDebug()); + $this->assertTrue($query->getBinarydebug()); + } + /** * @covers \PurplePixie\PhpDns\DNSQuery::query * @covers \PurplePixie\PhpDns\DNSTypes::getIdFromName