/** * @param string $ip * @param int $integer * * @dataProvider getIpAddressAsStringAndInteger * @covers \BreiteSeite\IP\IPv4\Address::getAsInteger() */ public function testFromString(string $ip, int $integer, string $binary) { $ip = Address::fromString($ip); $this->assertSame($integer, $ip->getAsInteger()); $this->assertSame($binary, $ip->getAsBinary()); }
/** * @covers BreiteSeite\IP\IPv6\Address::createIPv4Mapped() * @covers BreiteSeite\IP\IPv6\Address::getAsBinary() */ public function testCreateIpv4Mapped() { $address = Address::createIPv4Mapped(\BreiteSeite\IP\IPv4\Address::fromString('0.0.0.1')); $this->assertSame('00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111100000000000000000000000000000001', $address->getAsBinary()); }