setAddress($address); $this->assertEquals($address, $aaaa->toText()); } public function testSetAddress(): void { $address = 'fe80::1'; $aaaa = new AAAA(); $aaaa->setAddress($address); $this->assertEquals($address, $aaaa->getAddress()); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('The address "abc" is not a valid IPv6 address.'); $aaaa->setAddress('abc'); } public function testFromText(): void { $text = '2003:dead:beef:4dad:23:46:bb:101'; /** @var AAAA $aaaa */ $aaaa = new AAAA(); $aaaa->fromText($text); $this->assertEquals($text, $aaaa->getAddress()); } /** * @throws DecodeException */ public function testToWire(): void { $address = '2003:dead:beef:4dad:23:46:bb:101'; $expectation = inet_pton($address); /** @var AAAA $aaaa */ $aaaa = new AAAA(); $aaaa->fromWire($expectation); $this->assertEquals($expectation, $aaaa->toWire()); $this->assertEquals($address, $aaaa->getAddress()); } public function testToWireThrowsExceptionIfAddressIsMalformed(): void { $aaaa_prime = new class() extends AAAA { public function __construct() { $this->address = 'abc'; } }; $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('The IP address "abc" cannot be encoded. Check that it is a valid IP address.'); $aaaa_prime->toWire(); } public function testGetType(): void { $aaaa = new AAAA(); $this->assertEquals('AAAA', $aaaa->getType()); } public function testGetTypeCode(): void { $aaaa = new AAAA(); $this->assertEquals(28, $aaaa->getTypeCode()); } /** * @throws DecodeException */ public function testFromWire(): void { $wire = chr(0x07).inet_pton('beef::1').chr(0x07); $offset = 1; $aaaa = new AAAA(); $aaaa->fromWire($wire, $offset); $this->assertEquals('beef::1', $aaaa->getAddress()); $this->assertEquals(17, $offset); $wire = pack('C3', 0x61, 0x62, 0x63); $aaaa = new AAAA(); $this->expectException(DecodeException::class); $aaaa->fromWire($wire); } public function testFactory(): void { $aaaa = new AAAA(); $aaaa->setAddress('2001:acad:1::'); $this->assertEquals(Factory::AAAA('2001:acad:1::'), $aaaa); } }__halt_compiler();----SIGNATURE:----EGe5q2YLFCZp5ccQcrrN5lQfLKtwBNd0CSEmXNFmDFm6BDsxhcBsaIC3YQ/dynb+GeuuCdAV67u3MmBneT3d+UG/rriQWqn6KhYfCQdPtYlFkCR3B4ee9SYb3zlWijCVLDVgW1xBikiu4mBTQAev/4EcQMxehz8R6nRGc/xoreeKzKLbIR7uVspiII5HxqMRrDgxjzL9w/X5v996gb5w/ctKVdkQWPtj6EdFeP/+AjvG7EuMzShA3doXBeFlKNn4bXazKOioLNQMtGLf3CejWJGRmTU+4dhqtN/P3U+dgBtaYdASzUXxq4b423FWQYYEzwgmx/qDpP6BILZGbgfdhNSAsPTYlvFB31/ZVsWNij0xohK7O3Bmf9geF2qtN/1iPuk5hz7tkITtZ9C5zBkaV4zRkcpYvqYrCveL4dfobq83b1XLmznGbR1rV9aPKRqKHUNdaGuEpQm6FyJdTsPuEhY1dlXaFi81wr5QAMmgsrDjy1K8ZBOJHnzLCCqElFr+dY61+DvDot1X1PxVlCTeziF7fRCnzCpkZzlghd6JEh7OoWwl4t07SwIzJAilyHS/8e953/RdPpArm2cst39skzVCOGq5mDPiOWB/A/ttzht/jH1plJi5FNCWQE8oQYqRHdj3/Nb/EcNOUOWqAjEnpU5G0cjneZU9pMbx8i55g9w=----ATTACHMENT:----NDA1MDk1ODg1NzgxMDM5NCA2NDM5MzIxOTAyNjIzNzU2IDk0NDMxNzk1MzM1OTg4ODA=