示例#1
0
 public function testIpAddress()
 {
     $this->client->setIpAddress('8.8.8.8');
     $this->assertEquals('8.8.8.8', $this->client->getIpAddress());
     $this->client->setIpAddress('2001:4860:4860::8888');
     $this->assertEquals('2001:4860:4860::8888', $this->client->getIpAddress());
     try {
         $this->client->setIpAddress('2001');
         $this->fail('Invalid IP could be set');
     } catch (Exception $exception) {
     }
     try {
         $this->client->setIpAddress('0.0.0.0');
         $this->fail('Invalid IP could be set');
     } catch (Exception $exception) {
     }
     try {
         $this->client->setIpAddress('127.0.0.1');
         $this->fail('Local reserved IP could be set');
     } catch (Exception $exception) {
     }
 }