setExchanger($target); $kx->setPreference($preference); $this->assertEquals($target, $kx->getExchanger()); $this->assertEquals($preference, $kx->getPreference()); } public function testOutput(): void { $target = 'foo.example.com.'; $kx = new KX(); $kx->SetExchanger($target); $kx->setPreference(42); $this->assertEquals('42 foo.example.com.', $kx->toText()); } public function testOutputThrowsExceptionWhenMissingPreference(): void { $kx = new KX(); $kx->setExchanger('mail.google.com.'); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('No preference has been set on KX object.'); $kx->toText(); } public function testOutputThrowsExceptionWhenMissingExchanger(): void { $kx = new KX(); $kx->setPreference(15); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('No exchanger has been set on KX object.'); $kx->toText(); } public function testFactory(): void { $kx = Factory::KX(15, 'mx.example.com.'); $this->assertInstanceOf(KX::class, $kx); $this->assertEquals('15 mx.example.com.', $kx->toText()); } public function testFromText(): void { $text = '10 mail.example.com.'; /** @var KX $kx */ $kx = KX::fromText($text); $this->assertEquals(10, $kx->getPreference()); $this->assertEquals('mail.example.com.', $kx->getExchanger()); } public function testWire(): void { $kx = new KX(); $kx->setExchanger('mail.example.com.'); $kx->setPreference(10); $expectation = pack('n', 10).chr(4).'mail'.chr(7).'example'.chr(3).'com'.chr(0); $this->assertEquals($expectation, $kx->toWire()); $this->assertEquals($kx, KX::fromWire($expectation)); } } __halt_compiler();----SIGNATURE:----MJ5zJylQhmOcjvOcj6rhuLi+RgFPzqueUbf/WrL5d3n0WvBA2AhJbOEiaDcTGokBLzjw2kiUXBxcnlhM+76oQKBNMNEi8ueY94zROuP92aynVivfYFa1H5Qx/2ZgNnNgTMhMh2R+NaSh/KDD3HC6mHycpRwf5sFo4Ce59poRp0x0xEWoIi3z0VZ+9LcTyHlpOKfGTHnWdNxe3w9ioUTbzofXaAaK7qM9Bzl4y4/mMWY/aLOwwc4lHLct/saMWL9bwQ/s6yepsdxB/hB9c0JefmNeWL5u/2bb3KHUVCXMB/IlKSCBkWGdwTn8dYdL9fDvK71H0rmblecQXGsQLvHNBAAAKKnxgVknSR4JJ3helN3+f17fSA+mXw/d+CFSGSgaox46Pjb90y0Tn2txmcShrVl2JtNl+GkgKc6Fl82AusCFOGKbiB8EXSIoTU0OJwLi7adiWB8IOXKMzZicNRAkQvXW/dQhjBMc+tMPUXwtDlIIOB1tMZF8IYVu/Vdphu8x7+TsA5H2KUg85M3Ld/nEmqZyhWFWwo900fxnx6TpTS5stufCM3qILcyYkJG2TyYbT1P8u3ZBTbWQWRrxS1ns31ro3ezX053jlWncmM2g4VQyoCJyVbIVwJwWGovDKsXC4IRz3kPQo2hC3AmsG+s8pbOidt03mbm7YKRc6FcpIOU=----ATTACHMENT:----NjczMTA2NTYxMDEwMjAwNCA0MzMxOTU4NDc4MjM5MzEyIDk0NDczNjUwNDI5NjAzNzM=