/**
  * test that two consecutive get() calls reset the authentication credentials.
  *
  * @return void
  */
 public function testConsecutiveGetResetsAuthCredentials()
 {
     $socket = new MockHttpSocket();
     $socket->get('http://*****:*****@example.com/test');
     $this->assertEquals('mark', $socket->request['uri']['user']);
     $this->assertEquals('secret', $socket->request['uri']['pass']);
     $this->assertTrue(strpos($socket->request['header'], 'Authorization: Basic bWFyazpzZWNyZXQ=') !== false);
     $socket->get('/test2');
     $this->assertTrue(strpos($socket->request['header'], 'Authorization: Basic bWFyazpzZWNyZXQ=') !== false);
     $socket->get('/test3');
     $this->assertTrue(strpos($socket->request['header'], 'Authorization: Basic bWFyazpzZWNyZXQ=') !== false);
 }
Beispiel #2
0
 /**
  * test that two consecutive get() calls reset the authentication credentials.
  *
  * @return void
  */
 function testConsecutiveGetResetsAuthCredentials()
 {
     $socket = new MockHttpSocket();
     $socket->config['request']['auth'] = array('method' => 'Basic', 'user' => 'mark', 'pass' => 'secret');
     $socket->get('http://*****:*****@example.com/test');
     $this->assertEqual($socket->request['uri']['user'], 'mark');
     $this->assertEqual($socket->request['uri']['pass'], 'secret');
     $socket->get('/test2');
     $this->assertEqual($socket->request['auth']['user'], 'mark');
     $this->assertEqual($socket->request['auth']['pass'], 'secret');
     $socket->get('/test3');
     $this->assertEqual($socket->request['auth']['user'], 'mark');
     $this->assertEqual($socket->request['auth']['pass'], 'secret');
 }