1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Fix tests

This commit is contained in:
Jordi Boggiano 2012-10-18 18:43:31 +02:00
parent cf0753e062
commit e0ce22f7cc
4 changed files with 36 additions and 10 deletions

View file

@ -25,7 +25,7 @@ class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue(false))
;
$res = $this->callGetOptionsForUrl($io, array('http://example.org'));
$res = $this->callGetOptionsForUrl($io, array('http://example.org', array()));
$this->assertTrue(isset($res['http']['header']) && false !== strpos($res['http']['header'], 'User-Agent'), 'getOptions must return an array with a header containing a User-Agent');
}
@ -43,7 +43,7 @@ class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue(array('username' => 'login', 'password' => 'password')))
;
$options = $this->callGetOptionsForUrl($io, array('http://example.org'));
$options = $this->callGetOptionsForUrl($io, array('http://example.org', array()));
$this->assertContains('Authorization: Basic', $options['http']['header']);
}
@ -60,10 +60,28 @@ class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase
'allow_self_signed' => true,
));
$res = $this->callGetOptionsForUrl($io, array('https://example.org'), $streamOptions);
$res = $this->callGetOptionsForUrl($io, array('https://example.org', array()), $streamOptions);
$this->assertTrue(isset($res['ssl']) && isset($res['ssl']['allow_self_signed']) && true === $res['ssl']['allow_self_signed'], 'getOptions must return an array with a allow_self_signed set to true');
}
public function testGetOptionsForUrlWithCallOptionsKeepsHeader()
{
$io = $this->getMock('Composer\IO\IOInterface');
$io
->expects($this->once())
->method('hasAuthorization')
->will($this->returnValue(true))
;
$streamOptions = array('http' => array(
'header' => 'Foo: bar',
));
$res = $this->callGetOptionsForUrl($io, array('https://example.org', $streamOptions));
$this->assertTrue(isset($res['http']['header']), 'getOptions must return an array with a http.header key');
$this->assertGreaterThan(strlen('Foo: bar'), strlen($res['http']['header']));
}
public function testCallbackGetFileSize()
{
$fs = new RemoteFilesystem($this->getMock('Composer\IO\IOInterface'));