setNextDomainName('host.example.com.'); $nsec->addType(A::TYPE); $nsec->addType(MX::TYPE); $nsec->addType(RRSIG::TYPE); $nsec->addType(NSEC::TYPE); $this->assertEquals($expectation, $nsec->toText()); } public function testFactory(): void { $nextDomain = 'host.example.com.'; $bitMaps = [A::TYPE, MX::TYPE, RRSIG::TYPE, NSEC::TYPE]; $nsec = Factory::NSEC($nextDomain, $bitMaps); $this->assertEquals($nextDomain, $nsec->getNextDomainName()); $this->assertEquals($bitMaps, $nsec->getTypes()); } public function testClearTypeMap(): void { $nsec = new NSEC(); $nsec->addType(NS::TYPE); $nsec->addType(PTR::TYPE); $this->assertEquals([NS::TYPE, PTR::TYPE], $nsec->getTypes()); $nsec->clearTypes(); $this->assertEquals([], $nsec->getTypes()); } public function testFromText(): void { $text = 'host.example.com. A MX RRSIG NSEC TYPE1234'; /** @var NSEC $nsec */ $nsec = NSEC::fromText($text); $this->assertEquals('host.example.com.', $nsec->getNextDomainName()); $this->assertEquals(['A', 'MX', 'RRSIG', 'NSEC', 'TYPE1234'], $nsec->getTypes()); $this->assertEquals($text, $nsec->toText()); } public function testWire(): void { $hexMatrix = [ 0x04, ord('h'), ord('o'), ord('s'), ord('t'), 0x07, ord('e'), ord('x'), ord('a'), ord('m'), ord('p'), ord('l'), ord('e'), 0x03, ord('c'), ord('o'), ord('m'), 0x00, 0x00, 0x06, 0x40, 0x01, 0x00, 0x00, 0x00, 0x03, 0x01, 0x01, 0x40, 0x80, 0x01, 0x40, ]; $expectation = pack('C*', ...$hexMatrix); $text = 'host.example.com. A MX RRSIG NSEC CAA DLV'; /** @var NSEC $nsec */ $nsec = NSEC::fromText($text); $this->assertEquals($expectation, $nsec->toWire()); $this->assertEquals($nsec, NSEC::fromWire($expectation)); } } __halt_compiler();----SIGNATURE:----FUkVwdJC8EvM56MQzRg8EA/6tt4KvzBhpUG9CBVrrZHYks+K/3wSoYV0t19XMuXi3MUrr0uvwtCyzx3BQ1G62ykJ1htIrfmQeRd7slLy4DHRw54aUT0guy9CmOMCSn6s0dZN6TtJpdkCRKYFD5Zh7ApDWkLfDhFmlPsH6ETGfEDt6XADUUeatrOfFRS0E/Jtn/A3nsCzKwwqEMG4tzFnW67P3NjJkUWRQIbzr5bONwaFUKiD68jlVJbiOeFC7LBe/acuoho0F0jjRpNR0mvpu0h9MmnYmnNV6F/K99Nn7H6iwAbmiaL0Sxqve8Xt77+3KkFrMcICCkopRYcVzlNmQXcmO2V/wC3K8dvqZXQBJiwFpnT0AR9LMPl/kqCFxAmEIfGF+upMPs+U3XtHBqbnIosMQjb5gESyLxBKOyUHK4zowuZykZWMMmV+fMk0S01CZnR7iM/MyYJGfKX7/DX/0qD3LrN1aLKdv3rRaIB04M+/zSlc+WiuR/RzO7ez6UCBhXUXo+xUbsXFYT7+cYF5W2IPahA+590xGdMdheJuD80IZVfQzms+FqGpcaSGbLS0QXYIcrkyTThIVHTyVh0OATL4ihQpXhsNAAB1gAaH7/Hf+++7YxT7D3FJD0T45/ggxlXJXy3q+8Py+S+4ezKBM0PxzkB1wIxwpCMs8Bnq/NA=----ATTACHMENT:----NDc5NTI0NjQxNDgwNTA2MCA2MTY1NDQzMDExNjM2ODk2IDE2MDA4MTczMzAwNTcyOTA=