assertEquals($expectation, $apl->toText()); } public function testGetters(): void { $includedRanges = [ IPBlock::create('192.168.0.0/23'), IPBlock::create('2001:acad:1::/112'), ]; $excludedRanges = [ IPBlock::create('192.168.1.64/28'), IPBlock::create('2001:acad:1::8/128'), ]; $apl = Factory::APL($includedRanges, $excludedRanges); $this->assertEquals($includedRanges, $apl->getIncludedAddressRanges()); $this->assertEquals($excludedRanges, $apl->getExcludedAddressRanges()); } /** * @throws \Exception */ public function testFromText(): void { $text = '1:192.168.0.0/23 2:2001:acad:1::/112 !1:192.168.1.64/28 !2:2001:acad:1::8/128'; $expectation_incl = [ new IPv4Block('192.168.0.0', 23), new IPv6Block('2001:acad:1::', 112), ]; $expectation_excl = [ new IPv4Block('192.168.1.64', 28), new IPv6Block('2001:acad:1::8', 128), ]; /** @var APL $apl */ $apl = new APL(); $apl->fromText($text); $this->assertCount(2, $apl->getIncludedAddressRanges()); $this->assertCount(2, $apl->getExcludedAddressRanges()); $this->assertEquals($expectation_incl, $apl->getIncludedAddressRanges()); $this->assertEquals($expectation_excl, $apl->getExcludedAddressRanges()); } public function testWire(): void { $expectation = pack( 'nCCC4nCC', 1, //Address Family 24, //Prefix 0 + //N: "!" is present 4, //AFD Length 255, 255, 255, 255, //AFDPart 2, //Address Family 64, //Prefix 128 + //N: "!" is present 16 //AFD Length ).inet_pton('2001:acad:dead:beef::'); //AFDPart $apl = new APL(); $apl->addAddressRange(IPBlock::create('255.255.255.255/24'), true); $apl->addAddressRange(IPBlock::create('2001:acad:dead:beef::/64'), false); $this->assertEquals($expectation, $apl->toWire()); $aplFromWire = new APL(); $aplFromWire->fromWire($expectation); $this->assertCount(1, $apl->getIncludedAddressRanges()); $this->assertCount(1, $apl->getExcludedAddressRanges()); $this->assertEquals($apl, $aplFromWire); } }__halt_compiler();----SIGNATURE:----wVAtpn3Xe9yifpOUIyOcJqRqB4djMvajcr8YR3Y4C5GjyCgd66+DczhUUHFymAK2671o9eod/gqmayfQcJ7wIxwcMBzZN79ByuHe/1GeO5R34xd5tg9HAnLTV8pA6cFBEli2IIssJm6sdTuifoAPMVXYSQzplwm6HSthfU+Rcmm5nKTzAffh3OGgL3e0ZLP/fC4LQpE7B/jIp6RnWgijsXpXXR5c3nCr4i/01dwU4PRrP+tpr3uq+FiXzt0k5cYoRGquTBBFMgvrKMWh1RenYQLYZHN1sckO51uRDfAcccLwju41msLHGt8Mp6He4wegxJuWiAVgHjmVReP1zrrrl/DHDkGqi5+gb5PwG0jdnS1CzVZunUz56wMByUmlw8A+Azx4ubC3wZHG9YFPNOTRisoYFk5YVDlvVSXPvQuNUd5kPpbZsWfRi1fGT/Vx+7MwzyTlKba7PodzGFTUhGt49ng3+mGw7Nvg5bfBbK3ybseUc+3znHEpmblWTkoofcJYM7xWEmTUZyWzrFTLzmk38XyWXKu2vUIkj8+VRUZHry0Kycx7QqVawVY9LQsvPSP7V+EUZ+mRItbTtzJanO2Xl16lTjdfhuZ5UKJAuPUdXMoTP+Z3woxQhHSYcu2tu5EGJFE5ICHn9l+3KOHVtmI1f02Vx925J01HIByl7vv9eM0=----ATTACHMENT:----MjU2ODcwNDcwODY2MzUwNSA2Mjc2NjgwMjkwMzk0NDExIDUxOTgyMzMzMzkzMTYzMDk=