public function testSimple2()
 {
     $credentials = new BasicCredentials();
     $credentials->setUserName('foo');
     $this->assertSame('foo', $credentials->getUserName());
     $this->assertSame('', $credentials->getPassword());
     $credentials = new BasicCredentials();
     $credentials->setPassword('bar');
     $this->assertSame('', $credentials->getUserName());
     $this->assertSame('bar', $credentials->getPassword());
 }
Exemple #2
0
 public function testCredentials()
 {
     $proxy = new CurlProxy();
     $this->assertFalse($proxy->hasCredentials());
     $credentials = new BasicCredentials();
     $credentials->setUserName('foo');
     $credentials->setPassword('bar');
     $proxy->setCredentials($credentials);
     $this->assertInstanceOf(BasicCredentials::class, $proxy->getCredentials());
     $this->assertSame('foo:bar', $proxy->getFormattedCredentials());
     $this->assertSame('foo', $proxy->getCredentials()->getUserName());
     $this->assertSame('bar', $proxy->getCredentials()->getPassword());
     $this->assertSame([CURLOPT_PROXYUSERNAME => 'foo', CURLOPT_PROXYPASSWORD => 'bar'], $proxy->getOptions());
 }