setExchange($target); $mx->setPreference($preference); $this->assertEquals($target, $mx->getExchange()); $this->assertEquals($preference, $mx->getPreference()); } public function testOutput(): void { $target = 'foo.example.com.'; $mx = new MX(); $mx->SetExchange($target); $mx->setPreference(42); $this->assertEquals('42 foo.example.com.', $mx->toText()); } public function testOutputThrowsExceptionWhenMissingPreference(): void { $mx = new MX(); $mx->setExchange('mail.google.com.'); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('No preference has been set on MX object.'); $mx->toText(); } public function testOutputThrowsExceptionWhenMissingExchange(): void { $mx = new MX(); $mx->setPreference(15); $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('No exchange has been set on MX object.'); $mx->toText(); } public function testFromText(): void { $text = '10 mail.example.com.'; /** @var MX $mx */ $mx = MX::fromText($text); $this->assertEquals(10, $mx->getPreference()); $this->assertEquals('mail.example.com.', $mx->getExchange()); } public function testWire(): void { $mx = new MX(); $mx->setExchange('mail.example.com.'); $mx->setPreference(10); $expectation = pack('n', 10).chr(4).'mail'.chr(7).'example'.chr(3).'com'.chr(0); $this->assertEquals($expectation, $mx->toWire()); $this->assertEquals($mx, MX::fromWire($expectation)); } } __halt_compiler();----SIGNATURE:----ImVewSv8GMwquWi7OUtoDbDVD+wQNQSxBIY50q3zL0Yt/PC/YmGoeW/5+f4exWsgkUWd31j+LxErYIbHqTHndi24phhHmKsZ2l1UZ7doZiv41/dtqem4z+ncn6NbRb6SY2BvRO9K3TB7bF6HV8gbLlrhuYDkeCpaQy7ze/yU2uiE/LvvP05j7saQzq+wgRGr744k7Et97OSDK+XqXq6tX7B8Oz7B3HLESDwYdTTfL3hYNNoDp93DIXBDKPslIIVl4WChjX2dRJ/Naj7my3d2yUAdRc1mwIvK10mvSn/bOwvEMiQMuNWBXDImPBWAr0HSanm5H9Z/DOi8gKNNACfEK3dJOWine//SEafsm20SD1RJR2DFvtMm308wTXc8pgazL4PehFWGxVJkzYaqGvwo1gLXSTA/0gIwmKMmpBdJ+l6ChcEHkII8p9seTQs1Wfp0SJPCVbntIGnpSYDFbOTM+zDWFJ/g2jG/0is8EQpxQc7ptxUf2w+7fFBDf6E/pzRatO0nvpteeKX8Rtnh8JWip0SALtWBc3SN0xFuq/tJM3iqcqOrhKv8SVAIKo3s+QUK7pMaCJSh1RsSjbh9Uj1ZxqDt5LaYDWMS4KgXZIT2Id6rFELwpMfwIFwV8eTBt/syorNJLsPdqZClEAuzHtGmjPw/KNvX3mapxalya6TBwQc=----ATTACHMENT:----ODgzOTAxNTMwNTIzOTM3MSAyODcyMzE0NzIwNTgxODc0IDY3NjQ4MjQwNDgyNDExMA==