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 = 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 = APL::fromWire($expectation); $this->assertCount(1, $apl->getIncludedAddressRanges()); $this->assertCount(1, $apl->getExcludedAddressRanges()); $this->assertEquals($apl, $aplFromWire); } } __halt_compiler();----SIGNATURE:----XiZ8l4A64z3LRM28430CusVI/chzAaqYwazFNkVzODKG6BPIRsQPNV2HRWABj5ZT8oP9ENHrJWvx5LuBNQ9Ai+wYjGteBYSKWwnOB5IsnEIaJVJ4ej8c7YLHQcktPi36LP1bZHJ/KanHNMXe+47J0wH0kfioYFDc97nd8TgEJtXSGAEqcLtFncF7ooC5XON4Q5YecTNS8HKiku/7AgsxVhfkTaynKThgIhkt2rvy5CppmYktykslnKmKpeE21S1rpBofkGHEM56WgZMzCrZdE1djZP7xKJXSZ3c1HKvYl12yISj1iW3mUvcqA6H2kFESYlvy9A/XirFw+yJQwLn2+w/p8FMDNFLeZkpNYna3M3W5wl+EXBpnVz9r5AM8NegejNCFSnvXN5vtUGEtPmtuLx4C5IUrt9WFbP5ZfHA6vKtmjG/HQufFl2/o9KI+h35Z3ohOJdVhKMkrogukVFi1+tjnPGKXgIKCb5NCy9EqZZfjSRFhfCuAXAy5ozBDdSpeiW/dmoaJn/enQNkXLCGnrQnC1wnax4SwDyPLvpqkW98wQDq4tXAMMjNY2MFwTtsNoWCiOZnrU8B8iSGLAp8/kyOx26fzSbIgGErTJfqMC0E9PrIPC8F/uKx7rKQ3DxvlEhr2bK0dHX1jMDVq/X2fgONUHqjPUEUKiP/WFELYxW4=----ATTACHMENT:----NzM1OTAzMTQzMjA5Nzg0MCA2ODM3NjA0NjA5MzkzMDI3IDIzMjAwOTQyNDk0MTE0NDc=