You appear to be a bot. Output may be restricted
Description
Tests gethostbynamel()gethostbynamel() actually returns 3 addresses for my local computer name QW. These can be mapped to results from ipconfig
gethostbynamel() | ipconfig |
---|---|
[0] => 192.168.50.1 | Ethernet adapter VirtualBox Host-Only Network #2: |
[1] => 192.168.56.1 | Ethernet adapter VirtualBox Host-Only Network: |
[2] => 192.168.1.10 | Wireless LAN adapter WiFi: |
Usage
Tests_libs_class_oik_remote::test_gethostbynamel();
Parameters
Returns
voidTO DO
These IP addresses may change after a reboot. Cater for this somehow.Source
File name: oik-libs/tests/test-libs-class-oik-remote.phpLines:
1 to 23 of 23
function test_gethostbynamel() { $hosts = gethostbynamel( "localhost" ); $expected = array( "127.0.0.1" ); $this->assertEquals( $expected, $hosts ); $hosts = gethostbynamel( "localhost." ); $expected = array( "127.0.0.1" ); $this->assertEquals( $expected, $hosts ); if ( oik_remote::get_computer_name() == "qw" ) { $hosts = gethostbynamel( "qw" ); $expected = array( "192.168.50.1", "192.168.56.1", "192.168.1.16" ); $this->assertEquals( $expected, $hosts ); $hosts = gethostbynamel( "qw." ); $this->assertEquals( $expected, $hosts ); $hosts = gethostbynamel( "q.w" ); $expected = array( "127.0.0.1" ); $this->assertEquals( $expected, $hosts ); $hosts = gethostbynamel( "q.w." ); $this->assertEquals( $expected, $hosts ); } }View on GitHub