assertCount(1, $zone); /** @var ResourceRecord $rr */ $rr = $zone[0]; $this->assertEquals('dickens.example.com.', $rr->getName()); $this->assertEquals('CLASS45', $rr->getClass()); $this->assertEquals(45, $rr->getClassId()); $this->assertEquals('TYPE1859', $rr->getType()); $this->assertEquals(1800, $rr->getTtl()); $this->assertInstanceOf(UnknownType::class, $rr->getRdata()); $this->assertEquals($binData, $rr->getRdata()->getData()); $this->assertEquals(1859, $rr->getRdata()->getTypeCode()); } /** * @throws ParseException */ public function testPolymorphicType(): void { $text = 'dickens.example.com. IN 1800 RESERVED "A Tale of Two Cities"'; $zone = Parser::parse('example.com.', $text); $this->assertCount(1, $zone); /** @var ResourceRecord $rr */ $rr = $zone[0]; $this->assertEquals('dickens.example.com.', $rr->getName()); $this->assertEquals('IN', $rr->getClass()); $this->assertEquals(1, $rr->getClassId()); $this->assertEquals('RESERVED', $rr->getType()); $this->assertEquals(0xffff, $rr->getRdata()->getTypeCode()); $this->assertEquals(1800, $rr->getTtl()); $this->assertInstanceOf(PolymorphicRdata::class, $rr->getRdata()); $this->assertEquals('"A Tale of Two Cities"', $rr->getRdata()->getData()); } public function testSupportedTypeInUnknownFormatIsOutputtedAsCorrectType(): void { $record = 'files.example.com. IN 3600 TYPE1 \# 4 c0 a8 01 64'; $zone = Parser::parse('example.com.', $record); $this->assertCount(1, $zone); /** @var ResourceRecord $rr */ $rr = $zone[0]; $this->assertEquals('files.example.com.', $rr->getName()); $this->assertEquals(Classes::INTERNET, $rr->getClass()); $this->assertEquals(3600, $rr->getTtl()); $this->assertInstanceOf(A::class, $rr->getRdata()); $this->assertEquals('192.168.1.100', $rr->getRdata()->getAddress()); } } __halt_compiler();----SIGNATURE:----DKu1z79pEdSz8ljKSd5iMEfzJFvqjHUqe/VS9/eWgY2m5V9/hcZHI3j7DXDiunlTc0r9ij69hcT8KdBH1WUNYJai7Y8cSXQhfby9GIFIrW46NGlPUrWhRT9g/MXyMvJ8wUgGZf0Vi1896BB9llsXE5qWnZmhSFbu+jpaCC1lRn+jys2U4wjGJoLxGZg6LVNoXLURjJn9djA/OGMW6VnJ5W2bAdjIo6iTZKgJ1TnYb01kkkKFTKvnpd6I4PzhbD6dK2Kgl6q7DWZnuM66RZ/wgx6whBIQENdeFcBEfDfwCUoqk+7uOg/S1vIPZSQ/wsJQa+GLUd543SWantvzySQuvuUXhNK5zgaVCzpa9QJywF+e3BtWKpqcg4cxTB+Syj/2TReN1ZI7mWoe2sj0WW6/lDsHSd5FvBfHw73x4hYHG4kpaeMNfncw8u8xsnLan7yVWgxweaeHJGESslm/6DCmV06XH6HMXO558+2UQarNQF9XwNfx+bTNyZ609xjxlxXcopmJnlW0GRLloYfoNDcuwhi/MCr76KHHdJBEVxWIcdj7VpsMzE7fg08XO5aBRsVir/I0dWfn/WiKBKHY/NY/5+FOOeDtCtX5ETDh7SV4/4gj3XEEjxyHunfCKEvnovD0oQoUGd+cGEPMBwWs/vfnzYURwdeuQI+GbFmzBDweCDw=----ATTACHMENT:----NDU5NzQxMzg1NzkyMjM3IDg2NTA4OTYwMTA5MTQ5NzUgODExMTE2ODc5NzQxMzI5NQ==