getUserInfo() public method

Gets the user info.
public getUserInfo ( ) : string
return string A user name and, optionally, scheme-specific information about how to gain authorization to access the server
 /**
  * @param Request $request
  * @return array
  */
 private function prepareOptions(Request $request)
 {
     $options = array(CURLOPT_POST => 1, CURLOPT_HEADER => 0, CURLOPT_URL => $request->getSchemeAndHttpHost() . $request->getRequestUri(), CURLOPT_USERPWD => $request->getUserInfo(), CURLOPT_FRESH_CONNECT => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FORBID_REUSE => 1, CURLOPT_TIMEOUT => 20, CURLOPT_POSTFIELDS => $request->getContent(), CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => array('Content-Type: ' . $request->getContentType(), 'Content-Length: ' . strlen($request->getContent())));
     foreach ($this->options as $key => $value) {
         $options[$key] = $value;
     }
     return $options;
 }
Beispiel #2
0
 /**
  * @covers Symfony\Component\HttpFoundation\Request::getUserInfo
  */
 public function testGetUserInfo()
 {
     $request = new Request();
     $server['PHP_AUTH_USER'] = '******';
     $request->initialize(array(), array(), array(), array(), array(), $server);
     $this->assertEquals('fabien', $request->getUserInfo());
     $server['PHP_AUTH_USER'] = '******';
     $request->initialize(array(), array(), array(), array(), array(), $server);
     $this->assertEquals('0', $request->getUserInfo());
     $server['PHP_AUTH_PW'] = '0';
     $request->initialize(array(), array(), array(), array(), array(), $server);
     $this->assertEquals('0:0', $request->getUserInfo());
 }