setHostname($hostname); $afsdb->setSubType(2); $this->assertEquals('2 foo.example.com.', $afsdb->toText()); } public function testOutputThrowsExceptionWhenMissingSubType(): void { $afsdb = new AFSDB(); $afsdb->setHostname('foo.example.com.'); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('No sub-type has been set on AFSDB object.'); $afsdb->toText(); } public function testOutputThrowsExceptionWhenMissingHostname(): void { $afsdb = new AFSDB(); $afsdb->setSubType(15); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('No hostname has been set on AFSDB object.'); $afsdb->toText(); } public function testFromText(): void { $text = '2 foo.example.com.'; /** @var AFSDB $afsdb */ $afsdb = AFSDB::fromText($text); $this->assertEquals(2, $afsdb->getSubType()); $this->assertEquals('foo.example.com.', $afsdb->getHostname()); } public function testWire(): void { $afsdb = new AFSDB(); $afsdb->setHostname('foo.example.com.'); $afsdb->setSubType(2); $expectation = pack('n', 2).chr(3).'foo'.chr(7).'example'.chr(3).'com'.chr(0); $this->assertEquals($expectation, $afsdb->toWire()); $this->assertEquals($afsdb, AFSDB::fromWire($expectation)); } public function testFactory(): void { $afsdb = Factory::AFSDB(2, 'foo.example.com.'); $this->assertInstanceOf(AFSDB::class, $afsdb); $this->assertEquals('2 foo.example.com.', $afsdb->toText()); } } __halt_compiler();----SIGNATURE:----24+bBtH9tWt0A5E8KW9b+AYDSGxBBEewnWsj74ek7y2fBrQDiX/nrbDiPveL/q7CDCEU3Rd1adJPtdr4P1DivMlZt9bTb6RRKOLwThMtJQn54P7WKrUTyXW9sDRw8C+FOYwHHVXUFDZhq66Nq6PBx1XA5nwiRNgkDUMFlEE2HB1Dt20/SUpL6fdmBb32r6SbQ/Q2E7IkE5rE5K7W6GIPW1xwCea4/tiu/L/WLMbJMeJRUBxPVjPDKuKE05amHevgMwqlYz2E4+kd1WjdVTZVgvWhSTAlXqMo/JCdWSEvqG+qwg4uqBaC+bSxwJgNqTZU5vP9VkN/CljVetcXTD+k4HQC1ogx+HGHDyZEENbzC/VTz98ZmdtC9zIBrdMdGPpSHW4g9UnsSnt1kEPl0DFGOWzj4wSnUlJaXyAyTV2421u9C6VonkdCxsnR4n6NyxDNujT8X8oZJOUYOMieMpj5zHmFYkJUD8WTutertM3kglpF40eTUkAf5Lgt4MEwIBnRCH5AXy986H7yH2aF9HKS9MN59GJDbKEYKtKIuK7IvtKscR8WARyPmoijOFPqhNHCskvPyiJUuEOwh4z1Akq2rWXB94odpe7/56GNrTSuYLD+gdTdn7QM+1psltnejIOQMnfrrTyL5J4C9CQp8mmeI3lg8NYCq0MJK/MVkTnAb+M=----ATTACHMENT:----NjM5MDI1NjA3ODgwODg3NiAxMzg1MTcxODg1OTQ4NzU4IDk5NzA4MTAyNDYwNTU4NTA=