mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
trim token just in case and update tests
This commit is contained in:
parent
41f4451c20
commit
52d290f5f2
3 changed files with 13 additions and 105 deletions
|
@ -64,24 +64,19 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
|
|||
->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false))
|
||||
->will($this->throwException(new TransportException('HTTP/1.1 404 Not Found', 404)));
|
||||
|
||||
$io->expects($this->once())
|
||||
->method('ask')
|
||||
->with($this->equalTo('Username: '))
|
||||
->will($this->returnValue('someuser'));
|
||||
|
||||
$io->expects($this->once())
|
||||
->method('askAndHideAnswer')
|
||||
->with($this->equalTo('Password: '))
|
||||
->will($this->returnValue('somepassword'));
|
||||
->with($this->equalTo('Token (hidden): '))
|
||||
->will($this->returnValue('sometoken'));
|
||||
|
||||
$io->expects($this->any())
|
||||
->method('setAuthentication')
|
||||
->with($this->equalTo('github.com'), $this->matchesRegularExpression('{someuser|abcdef}'), $this->matchesRegularExpression('{somepassword|x-oauth-basic}'));
|
||||
->with($this->equalTo('github.com'), $this->matchesRegularExpression('{sometoken}'), $this->matchesRegularExpression('{x-oauth-basic}'));
|
||||
|
||||
$remoteFilesystem->expects($this->at(1))
|
||||
->method('getContents')
|
||||
->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/authorizations'), $this->equalTo(false))
|
||||
->will($this->returnValue('{"token": "abcdef"}'));
|
||||
->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/rate_limit'), $this->equalTo(false))
|
||||
->will($this->returnValue('{}'));
|
||||
|
||||
$remoteFilesystem->expects($this->at(2))
|
||||
->method('getContents')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue