Пример #1
0
 public function testGetRemoteAddressVerifyPriorityHeader()
 {
     $this->config->expects($this->at(0))->method('getSystemValue')->with('trusted_proxies')->will($this->returnValue(['10.0.0.2']));
     $this->config->expects($this->at(1))->method('getSystemValue')->with('forwarded_for_headers')->will($this->returnValue(['HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED']));
     $request = new Request(['server' => ['REMOTE_ADDR' => '10.0.0.2', 'HTTP_X_FORWARDED' => '10.4.0.5, 10.4.0.4', 'HTTP_X_FORWARDED_FOR' => '192.168.0.233']], $this->secureRandom, $this->getMock('\\OCP\\Security\\ICrypto'), $this->config, $this->stream);
     $this->assertSame('192.168.0.233', $request->getRemoteAddress());
 }