Add return types to tests (#10)
parent
1321bfca36
commit
e9b60580f5
|
@ -100,10 +100,10 @@ class AutoloadGeneratorTest extends TestCase
|
||||||
$this->config = $this->getMockBuilder('Composer\Config')->getMock();
|
$this->config = $this->getMockBuilder('Composer\Config')->getMock();
|
||||||
|
|
||||||
$this->configValueMap = array(
|
$this->configValueMap = array(
|
||||||
'vendor-dir' => function () {
|
'vendor-dir' => function (): string {
|
||||||
return $this->vendorDir;
|
return $this->vendorDir;
|
||||||
},
|
},
|
||||||
'platform-check' => function () {
|
'platform-check' => function (): bool {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -130,7 +130,7 @@ class AutoloadGeneratorTest extends TestCase
|
||||||
->getMock();
|
->getMock();
|
||||||
$this->im->expects($this->any())
|
$this->im->expects($this->any())
|
||||||
->method('getInstallPath')
|
->method('getInstallPath')
|
||||||
->will($this->returnCallback(function ($package) {
|
->will($this->returnCallback(function ($package): string {
|
||||||
$targetDir = $package->getTargetDir();
|
$targetDir = $package->getTargetDir();
|
||||||
|
|
||||||
return $this->vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
|
return $this->vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
|
||||||
|
@ -1354,7 +1354,7 @@ EOF;
|
||||||
->getMock();
|
->getMock();
|
||||||
$im->expects($this->any())
|
$im->expects($this->any())
|
||||||
->method('getInstallPath')
|
->method('getInstallPath')
|
||||||
->will($this->returnCallback(function ($package) use ($vendorDir) {
|
->will($this->returnCallback(function ($package) use ($vendorDir): string {
|
||||||
$targetDir = $package->getTargetDir();
|
$targetDir = $package->getTargetDir();
|
||||||
|
|
||||||
return $vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
|
return $vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
|
||||||
|
|
|
@ -61,7 +61,7 @@ class RunScriptCommandTest extends TestCase
|
||||||
|
|
||||||
$ed->expects($this->once())
|
$ed->expects($this->once())
|
||||||
->method('hasEventListeners')
|
->method('hasEventListeners')
|
||||||
->with($this->callback(function (ScriptEvent $event) use ($scriptName, $expectedDevMode) {
|
->with($this->callback(function (ScriptEvent $event) use ($scriptName, $expectedDevMode): bool {
|
||||||
return $event->getName() === $scriptName
|
return $event->getName() === $scriptName
|
||||||
&& $event->isDevMode() === $expectedDevMode;
|
&& $event->isDevMode() === $expectedDevMode;
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -174,7 +174,7 @@ class JsonConfigSourceTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* Provide data for testAddLink
|
* Provide data for testAddLink
|
||||||
*/
|
*/
|
||||||
public function provideAddLinkData()
|
public function provideAddLinkData(): array
|
||||||
{
|
{
|
||||||
$empty = $this->fixturePath('composer-empty.json');
|
$empty = $this->fixturePath('composer-empty.json');
|
||||||
$oneOfEverything = $this->fixturePath('composer-one-of-everything.json');
|
$oneOfEverything = $this->fixturePath('composer-one-of-everything.json');
|
||||||
|
@ -230,7 +230,7 @@ class JsonConfigSourceTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* Provide data for testRemoveLink
|
* Provide data for testRemoveLink
|
||||||
*/
|
*/
|
||||||
public function provideRemoveLinkData()
|
public function provideRemoveLinkData(): array
|
||||||
{
|
{
|
||||||
$oneOfEverything = $this->fixturePath('composer-one-of-everything.json');
|
$oneOfEverything = $this->fixturePath('composer-one-of-everything.json');
|
||||||
$twoOfEverything = $this->fixturePath('composer-two-of-everything.json');
|
$twoOfEverything = $this->fixturePath('composer-two-of-everything.json');
|
||||||
|
|
|
@ -34,7 +34,7 @@ class ConfigTest extends TestCase
|
||||||
$this->assertEquals($expected, $config->getRepositories());
|
$this->assertEquals($expected, $config->getRepositories());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataAddPackagistRepository()
|
public function dataAddPackagistRepository(): array
|
||||||
{
|
{
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['local config inherits system defaults'] = array(
|
$data['local config inherits system defaults'] = array(
|
||||||
|
@ -282,7 +282,7 @@ class ConfigTest extends TestCase
|
||||||
'ssh://[user@]host.xz[:port]/path/to/repo.git/',
|
'ssh://[user@]host.xz[:port]/path/to/repo.git/',
|
||||||
);
|
);
|
||||||
|
|
||||||
return array_combine($urls, array_map(function ($e) {
|
return array_combine($urls, array_map(function ($e): array {
|
||||||
return array($e);
|
return array($e);
|
||||||
}, $urls));
|
}, $urls));
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ class ConfigTest extends TestCase
|
||||||
'git://5.6.7.8/git.git',
|
'git://5.6.7.8/git.git',
|
||||||
);
|
);
|
||||||
|
|
||||||
return array_combine($urls, array_map(function ($e) {
|
return array_combine($urls, array_map(function ($e): array {
|
||||||
return array($e);
|
return array($e);
|
||||||
}, $urls));
|
}, $urls));
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ class PoolBuilderTest extends TestCase
|
||||||
$minimumStability = !empty($root['minimum-stability']) ? $root['minimum-stability'] : 'stable';
|
$minimumStability = !empty($root['minimum-stability']) ? $root['minimum-stability'] : 'stable';
|
||||||
$stabilityFlags = !empty($root['stability-flags']) ? $root['stability-flags'] : array();
|
$stabilityFlags = !empty($root['stability-flags']) ? $root['stability-flags'] : array();
|
||||||
$rootReferences = !empty($root['references']) ? $root['references'] : array();
|
$rootReferences = !empty($root['references']) ? $root['references'] : array();
|
||||||
$stabilityFlags = array_map(function ($stability) {
|
$stabilityFlags = array_map(function ($stability): int {
|
||||||
return BasePackage::$stabilities[$stability];
|
return BasePackage::$stabilities[$stability];
|
||||||
}, $stabilityFlags);
|
}, $stabilityFlags);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class PoolBuilderTest extends TestCase
|
||||||
|
|
||||||
$loader = new ArrayLoader(null, true);
|
$loader = new ArrayLoader(null, true);
|
||||||
$packageIds = array();
|
$packageIds = array();
|
||||||
$loadPackage = function ($data) use ($loader, &$packageIds) {
|
$loadPackage = function ($data) use ($loader, &$packageIds): \Composer\Package\PackageInterface {
|
||||||
/** @var ?int $id */
|
/** @var ?int $id */
|
||||||
$id = null;
|
$id = null;
|
||||||
if (!empty($data['id'])) {
|
if (!empty($data['id'])) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ class PoolOptimizerTest extends TestCase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideIntegrationTests()
|
public function provideIntegrationTests(): array
|
||||||
{
|
{
|
||||||
$fixturesDir = realpath(__DIR__.'/Fixtures/pooloptimizer/');
|
$fixturesDir = realpath(__DIR__.'/Fixtures/pooloptimizer/');
|
||||||
$tests = array();
|
$tests = array();
|
||||||
|
|
|
@ -115,7 +115,7 @@ class ArchiveDownloaderTest extends TestCase
|
||||||
$this->assertEquals($expected, $url);
|
$this->assertEquals($expected, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideUrls()
|
public function provideUrls(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('https://api.github.com/repos/composer/composer/zipball/master'),
|
array('https://api.github.com/repos/composer/composer/zipball/master'),
|
||||||
|
@ -154,7 +154,7 @@ class ArchiveDownloaderTest extends TestCase
|
||||||
$this->assertEquals($expected, $url);
|
$this->assertEquals($expected, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideBitbucketUrls()
|
public function provideBitbucketUrls(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('https://bitbucket.org/davereid/drush-virtualhost/get/77ca490c26ac818e024d1138aa8bd3677d1ef21f', 'zip'),
|
array('https://bitbucket.org/davereid/drush-virtualhost/get/77ca490c26ac818e024d1138aa8bd3677d1ef21f', 'zip'),
|
||||||
|
|
|
@ -666,7 +666,7 @@ class DownloadManagerTest extends TestCase
|
||||||
$this->assertEquals($expected, $method->invoke($manager, $target, $initial ?? null));
|
$this->assertEquals($expected, $method->invoke($manager, $target, $initial ?? null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function updatesProvider()
|
public static function updatesProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
// prevPkg source, prevPkg isDev, pkg available, pkg isDev, expected
|
// prevPkg source, prevPkg isDev, pkg available, pkg isDev, expected
|
||||||
|
|
|
@ -228,7 +228,7 @@ class FileDownloaderTest extends TestCase
|
||||||
$cacheMock
|
$cacheMock
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('copyTo')
|
->method('copyTo')
|
||||||
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey) {
|
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
|
||||||
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyTo method:');
|
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyTo method:');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -236,7 +236,7 @@ class FileDownloaderTest extends TestCase
|
||||||
$cacheMock
|
$cacheMock
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('copyFrom')
|
->method('copyFrom')
|
||||||
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey) {
|
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
|
||||||
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyFrom method:');
|
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyFrom method:');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -328,7 +328,7 @@ class FileDownloaderTest extends TestCase
|
||||||
$cacheMock
|
$cacheMock
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('copyTo')
|
->method('copyTo')
|
||||||
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey) {
|
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
|
||||||
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyTo method:');
|
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyTo method:');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -336,7 +336,7 @@ class FileDownloaderTest extends TestCase
|
||||||
$cacheMock
|
$cacheMock
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('copyFrom')
|
->method('copyFrom')
|
||||||
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey) {
|
->will($this->returnCallback(function ($cacheKey) use ($expectedCacheKey): bool {
|
||||||
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyFrom method:');
|
$this->assertEquals($expectedCacheKey, $cacheKey, 'Failed assertion on $cacheKey argument of Cache::copyFrom method:');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -220,7 +220,7 @@ class GitDownloaderTest extends TestCase
|
||||||
$downloader->cleanup('install', $packageMock, 'composerPath');
|
$downloader->cleanup('install', $packageMock, 'composerPath');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pushUrlProvider()
|
public function pushUrlProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
// ssh proto should use git@ all along
|
// ssh proto should use git@ all along
|
||||||
|
|
|
@ -120,7 +120,7 @@ class EventDispatcherTest extends TestCase
|
||||||
$dispatcher->hasEventListeners($event);
|
$dispatcher->hasEventListeners($event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideDevModes()
|
public function provideDevModes(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(true),
|
array(true),
|
||||||
|
@ -382,7 +382,7 @@ class EventDispatcherTest extends TestCase
|
||||||
|
|
||||||
$dispatcher->expects($this->atLeastOnce())
|
$dispatcher->expects($this->atLeastOnce())
|
||||||
->method('getListeners')
|
->method('getListeners')
|
||||||
->will($this->returnCallback(function (Event $event) {
|
->will($this->returnCallback(function (Event $event): array {
|
||||||
if ($event->getName() === 'root') {
|
if ($event->getName() === 'root') {
|
||||||
return array('@group');
|
return array('@group');
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ class EventDispatcherTest extends TestCase
|
||||||
|
|
||||||
$dispatcher->expects($this->atLeastOnce())
|
$dispatcher->expects($this->atLeastOnce())
|
||||||
->method('getListeners')
|
->method('getListeners')
|
||||||
->will($this->returnCallback(function (Event $event) {
|
->will($this->returnCallback(function (Event $event): array {
|
||||||
if ($event->getName() === 'hello') {
|
if ($event->getName() === 'hello') {
|
||||||
return array('echo Hello');
|
return array('echo Hello');
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ class EventDispatcherTest extends TestCase
|
||||||
|
|
||||||
$dispatcher->expects($this->atLeastOnce())
|
$dispatcher->expects($this->atLeastOnce())
|
||||||
->method('getListeners')
|
->method('getListeners')
|
||||||
->will($this->returnCallback(function (Event $event) {
|
->will($this->returnCallback(function (Event $event): array {
|
||||||
if ($event->getName() === 'root') {
|
if ($event->getName() === 'root') {
|
||||||
return array('@recurse');
|
return array('@recurse');
|
||||||
}
|
}
|
||||||
|
@ -500,7 +500,7 @@ class EventDispatcherTest extends TestCase
|
||||||
return $dispatcher;
|
return $dispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideValidCommands()
|
public function provideValidCommands(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('phpunit'),
|
array('phpunit'),
|
||||||
|
|
|
@ -83,7 +83,7 @@ class ConsoleIOTest extends TestCase
|
||||||
$outputMock->expects($this->once())
|
$outputMock->expects($this->once())
|
||||||
->method('write')
|
->method('write')
|
||||||
->with(
|
->with(
|
||||||
$this->callback(function ($messages) {
|
$this->callback(function ($messages): bool {
|
||||||
$result = Preg::isMatch("[(.*)/(.*) First line]", $messages[0]);
|
$result = Preg::isMatch("[(.*)/(.*) First line]", $messages[0]);
|
||||||
$result = $result && Preg::isMatch("[(.*)/(.*) Second line]", $messages[1]);
|
$result = $result && Preg::isMatch("[(.*)/(.*) Second line]", $messages[1]);
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ class ConsoleIOTest extends TestCase
|
||||||
->will($this->returnValue($helperMock))
|
->will($this->returnValue($helperMock))
|
||||||
;
|
;
|
||||||
|
|
||||||
$validator = function ($value) {
|
$validator = function ($value): bool {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
$consoleIO = new ConsoleIO($inputMock, $outputMock, $setMock);
|
$consoleIO = new ConsoleIO($inputMock, $outputMock, $setMock);
|
||||||
|
|
|
@ -65,7 +65,7 @@ class NullIOTest extends TestCase
|
||||||
{
|
{
|
||||||
$io = new NullIO();
|
$io = new NullIO();
|
||||||
|
|
||||||
$this->assertEquals('foo', $io->askAndValidate('question', function ($x) {
|
$this->assertEquals('foo', $io->askAndValidate('question', function ($x): bool {
|
||||||
return true;
|
return true;
|
||||||
}, null, 'foo'));
|
}, null, 'foo'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ class InstalledVersionsTest extends TestCase
|
||||||
$this->assertSame($expected, InstalledVersions::isInstalled($name, $includeDevRequirements));
|
$this->assertSame($expected, InstalledVersions::isInstalled($name, $includeDevRequirements));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isInstalledProvider()
|
public static function isInstalledProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(true, 'foo/impl'),
|
array(true, 'foo/impl'),
|
||||||
|
@ -104,7 +104,7 @@ class InstalledVersionsTest extends TestCase
|
||||||
$this->assertSame($expected, InstalledVersions::satisfies(new VersionParser, $name, $constraint));
|
$this->assertSame($expected, InstalledVersions::satisfies(new VersionParser, $name, $constraint));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function satisfiesProvider()
|
public static function satisfiesProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(true, 'foo/impl', '1.5'),
|
array(true, 'foo/impl', '1.5'),
|
||||||
|
@ -144,7 +144,7 @@ class InstalledVersionsTest extends TestCase
|
||||||
$this->assertSame($expected, InstalledVersions::getVersionRanges($name));
|
$this->assertSame($expected, InstalledVersions::getVersionRanges($name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getVersionRangesProvider()
|
public static function getVersionRangesProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('dev-master || 1.10.x-dev', '__root__'),
|
array('dev-master || 1.10.x-dev', '__root__'),
|
||||||
|
@ -168,7 +168,7 @@ class InstalledVersionsTest extends TestCase
|
||||||
$this->assertSame($expected, InstalledVersions::getVersion($name));
|
$this->assertSame($expected, InstalledVersions::getVersion($name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getVersionProvider()
|
public static function getVersionProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('dev-master', '__root__'),
|
array('dev-master', '__root__'),
|
||||||
|
@ -192,7 +192,7 @@ class InstalledVersionsTest extends TestCase
|
||||||
$this->assertSame($expected, InstalledVersions::getPrettyVersion($name));
|
$this->assertSame($expected, InstalledVersions::getPrettyVersion($name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPrettyVersionProvider()
|
public static function getPrettyVersionProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('dev-master', '__root__'),
|
array('dev-master', '__root__'),
|
||||||
|
@ -247,7 +247,7 @@ class InstalledVersionsTest extends TestCase
|
||||||
$this->assertSame($expected, InstalledVersions::getReference($name));
|
$this->assertSame($expected, InstalledVersions::getReference($name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getReferenceProvider()
|
public static function getReferenceProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('sourceref-by-default', '__root__'),
|
array('sourceref-by-default', '__root__'),
|
||||||
|
|
|
@ -87,7 +87,7 @@ class BinaryInstallerTest extends TestCase
|
||||||
$this->assertEquals('success arg', $output);
|
$this->assertEquals('success arg', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function executableBinaryProvider()
|
public function executableBinaryProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'simple php file' => array(<<<'EOL'
|
'simple php file' => array(<<<'EOL'
|
||||||
|
|
|
@ -50,7 +50,7 @@ class InstallationManagerTest extends TestCase
|
||||||
$installer
|
$installer
|
||||||
->expects($this->exactly(2))
|
->expects($this->exactly(2))
|
||||||
->method('supports')
|
->method('supports')
|
||||||
->will($this->returnCallback(function ($arg) {
|
->will($this->returnCallback(function ($arg): bool {
|
||||||
return $arg === 'vendor';
|
return $arg === 'vendor';
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class InstallationManagerTest extends TestCase
|
||||||
$installer
|
$installer
|
||||||
->expects($this->exactly(2))
|
->expects($this->exactly(2))
|
||||||
->method('supports')
|
->method('supports')
|
||||||
->will($this->returnCallback(function ($arg) {
|
->will($this->returnCallback(function ($arg): bool {
|
||||||
return $arg === 'vendor';
|
return $arg === 'vendor';
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ class InstallationManagerTest extends TestCase
|
||||||
$installer2
|
$installer2
|
||||||
->expects($this->exactly(1))
|
->expects($this->exactly(1))
|
||||||
->method('supports')
|
->method('supports')
|
||||||
->will($this->returnCallback(function ($arg) {
|
->will($this->returnCallback(function ($arg): bool {
|
||||||
return $arg === 'vendor';
|
return $arg === 'vendor';
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ class InstallationManagerTest extends TestCase
|
||||||
$bundleInstaller
|
$bundleInstaller
|
||||||
->expects($this->exactly(2))
|
->expects($this->exactly(2))
|
||||||
->method('supports')
|
->method('supports')
|
||||||
->will($this->returnCallback(function ($arg) {
|
->will($this->returnCallback(function ($arg): bool {
|
||||||
return $arg === 'bundles';
|
return $arg === 'bundles';
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ class InstallerTest extends TestCase
|
||||||
}));
|
}));
|
||||||
$lockJsonMock->expects($this->any())
|
$lockJsonMock->expects($this->any())
|
||||||
->method('exists')
|
->method('exists')
|
||||||
->will($this->returnCallback(function () use (&$lockData) {
|
->will($this->returnCallback(function () use (&$lockData): bool {
|
||||||
return $lockData !== null;
|
return $lockData !== null;
|
||||||
}));
|
}));
|
||||||
$lockJsonMock->expects($this->any())
|
$lockJsonMock->expects($this->any())
|
||||||
|
@ -172,7 +172,7 @@ class InstallerTest extends TestCase
|
||||||
return $comparable;
|
return $comparable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideInstaller()
|
public function provideInstaller(): array
|
||||||
{
|
{
|
||||||
$cases = array();
|
$cases = array();
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ class InstallerTest extends TestCase
|
||||||
}));
|
}));
|
||||||
$lockJsonMock->expects($this->any())
|
$lockJsonMock->expects($this->any())
|
||||||
->method('exists')
|
->method('exists')
|
||||||
->will($this->returnCallback(function () use (&$lockData) {
|
->will($this->returnCallback(function () use (&$lockData): bool {
|
||||||
return $lockData !== null;
|
return $lockData !== null;
|
||||||
}));
|
}));
|
||||||
$lockJsonMock->expects($this->any())
|
$lockJsonMock->expects($this->any())
|
||||||
|
@ -390,7 +390,7 @@ class InstallerTest extends TestCase
|
||||||
$install->addOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY);
|
$install->addOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY);
|
||||||
$install->addOption('no-dev', null, InputOption::VALUE_NONE);
|
$install->addOption('no-dev', null, InputOption::VALUE_NONE);
|
||||||
$install->addOption('dry-run', null, InputOption::VALUE_NONE);
|
$install->addOption('dry-run', null, InputOption::VALUE_NONE);
|
||||||
$install->setCode(function ($input, $output) use ($installer) {
|
$install->setCode(function ($input, $output) use ($installer): int {
|
||||||
$ignorePlatformReqs = $input->getOption('ignore-platform-reqs') ?: ($input->getOption('ignore-platform-req') ?: false);
|
$ignorePlatformReqs = $input->getOption('ignore-platform-reqs') ?: ($input->getOption('ignore-platform-req') ?: false);
|
||||||
|
|
||||||
$installer
|
$installer
|
||||||
|
@ -414,9 +414,9 @@ class InstallerTest extends TestCase
|
||||||
$update->addOption('prefer-stable', null, InputOption::VALUE_NONE);
|
$update->addOption('prefer-stable', null, InputOption::VALUE_NONE);
|
||||||
$update->addOption('prefer-lowest', null, InputOption::VALUE_NONE);
|
$update->addOption('prefer-lowest', null, InputOption::VALUE_NONE);
|
||||||
$update->addArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL);
|
$update->addArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL);
|
||||||
$update->setCode(function ($input, $output) use ($installer) {
|
$update->setCode(function ($input, $output) use ($installer): int {
|
||||||
$packages = $input->getArgument('packages');
|
$packages = $input->getArgument('packages');
|
||||||
$filteredPackages = array_filter($packages, function ($package) {
|
$filteredPackages = array_filter($packages, function ($package): bool {
|
||||||
return !in_array($package, array('lock', 'nothing', 'mirrors'), true);
|
return !in_array($package, array('lock', 'nothing', 'mirrors'), true);
|
||||||
});
|
});
|
||||||
$updateMirrors = $input->getOption('lock') || count($filteredPackages) != count($packages);
|
$updateMirrors = $input->getOption('lock') || count($filteredPackages) != count($packages);
|
||||||
|
@ -483,7 +483,7 @@ class InstallerTest extends TestCase
|
||||||
$actualInstalled[] = $package;
|
$actualInstalled[] = $package;
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($actualInstalled, function ($a, $b) {
|
usort($actualInstalled, function ($a, $b): int {
|
||||||
return strcmp($a['name'], $b['name']);
|
return strcmp($a['name'], $b['name']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -502,12 +502,12 @@ class InstallerTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideSlowIntegrationTests()
|
public function provideSlowIntegrationTests(): array
|
||||||
{
|
{
|
||||||
return $this->loadIntegrationTests('installer-slow/');
|
return $this->loadIntegrationTests('installer-slow/');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideIntegrationTests()
|
public function provideIntegrationTests(): array
|
||||||
{
|
{
|
||||||
return $this->loadIntegrationTests('installer/');
|
return $this->loadIntegrationTests('installer/');
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class JsonManipulatorTest extends TestCase
|
||||||
$this->assertEquals($expected, $manipulator->getContents());
|
$this->assertEquals($expected, $manipulator->getContents());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function linkProvider()
|
public function linkProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
|
@ -1308,7 +1308,7 @@ class JsonManipulatorTest extends TestCase
|
||||||
$this->assertEquals($expected, $manipulator->getContents());
|
$this->assertEquals($expected, $manipulator->getContents());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function providerAddLinkAndSortPackages()
|
public function providerAddLinkAndSortPackages(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
|
@ -1395,7 +1395,7 @@ class JsonManipulatorTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeSubNodeProvider()
|
public function removeSubNodeProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'works on simple ones first' => array(
|
'works on simple ones first' => array(
|
||||||
|
|
|
@ -35,7 +35,7 @@ class JsonValidationExceptionTest extends TestCase
|
||||||
$this->assertEquals(array(), $object->getErrors());
|
$this->assertEquals(array(), $object->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function errorProvider()
|
public function errorProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('test message', array(), 'test message', []),
|
array('test message', array(), 'test message', []),
|
||||||
|
|
|
@ -91,7 +91,7 @@ class HttpDownloaderMock extends HttpDownloader
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->expectations) > 0) {
|
if (count($this->expectations) > 0) {
|
||||||
$expectations = array_map(function ($expect) {
|
$expectations = array_map(function ($expect): string {
|
||||||
return $expect['url'];
|
return $expect['url'];
|
||||||
}, $this->expectations);
|
}, $this->expectations);
|
||||||
throw new AssertionFailedError(
|
throw new AssertionFailedError(
|
||||||
|
|
|
@ -53,7 +53,7 @@ class ProcessExecutorMock extends ProcessExecutor
|
||||||
{
|
{
|
||||||
/** @var array{cmd: string|list<string>, return?: int, stdout?: string, stderr?: string, callback?: callable} $default */
|
/** @var array{cmd: string|list<string>, return?: int, stdout?: string, stderr?: string, callback?: callable} $default */
|
||||||
$default = array('cmd' => '', 'return' => 0, 'stdout' => '', 'stderr' => '', 'callback' => null);
|
$default = array('cmd' => '', 'return' => 0, 'stdout' => '', 'stderr' => '', 'callback' => null);
|
||||||
$this->expectations = array_map(function ($expect) use ($default) {
|
$this->expectations = array_map(function ($expect) use ($default): array {
|
||||||
if (is_string($expect)) {
|
if (is_string($expect)) {
|
||||||
$command = $expect;
|
$command = $expect;
|
||||||
$expect = $default;
|
$expect = $default;
|
||||||
|
@ -89,7 +89,7 @@ class ProcessExecutorMock extends ProcessExecutor
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->expectations) > 0) {
|
if (count($this->expectations) > 0) {
|
||||||
$expectations = array_map(function ($expect) {
|
$expectations = array_map(function ($expect): string {
|
||||||
return is_array($expect['cmd']) ? implode(' ', $expect['cmd']) : $expect['cmd'];
|
return is_array($expect['cmd']) ? implode(' ', $expect['cmd']) : $expect['cmd'];
|
||||||
}, $this->expectations);
|
}, $this->expectations);
|
||||||
throw new AssertionFailedError(
|
throw new AssertionFailedError(
|
||||||
|
|
|
@ -30,7 +30,7 @@ class GitExcludeFilterTest extends TestCase
|
||||||
$this->assertEquals($expected, $filter->parseGitAttributesLine($ignore));
|
$this->assertEquals($expected, $filter->parseGitAttributesLine($ignore));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function providePatterns()
|
public function providePatterns(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('app/config/parameters.yml export-ignore', array('{(?=[^\.])app/(?=[^\.])config/(?=[^\.])parameters\.yml(?=$|/)}', false, false)),
|
array('app/config/parameters.yml export-ignore', array('{(?=[^\.])app/(?=[^\.])config/(?=[^\.])parameters\.yml(?=$|/)}', false, false)),
|
||||||
|
|
|
@ -31,7 +31,7 @@ class ZipArchiverTest extends ArchiverTest
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideGitignoreExcludeNegationTestCases()
|
public function provideGitignoreExcludeNegationTestCases(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('!/docs'),
|
array('!/docs'),
|
||||||
|
|
|
@ -54,7 +54,7 @@ class BasePackageTest extends TestCase
|
||||||
$this->assertSame($expected, $package->getFullPrettyVersion($truncate));
|
$this->assertSame($expected, $package->getFullPrettyVersion($truncate));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideFormattedVersions()
|
public function provideFormattedVersions(): array
|
||||||
{
|
{
|
||||||
$data = array(
|
$data = array(
|
||||||
array(
|
array(
|
||||||
|
@ -79,7 +79,7 @@ class BasePackageTest extends TestCase
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$createPackage = function ($arr) {
|
$createPackage = function ($arr): array {
|
||||||
$package = $this->getMockForAbstractClass('\Composer\Package\BasePackage', array(), '', false);
|
$package = $this->getMockForAbstractClass('\Composer\Package\BasePackage', array(), '', false);
|
||||||
$package->expects($this->once())->method('isDev')->will($this->returnValue(true));
|
$package->expects($this->once())->method('isDev')->will($this->returnValue(true));
|
||||||
$package->expects($this->any())->method('getSourceType')->will($this->returnValue('git'));
|
$package->expects($this->any())->method('getSourceType')->will($this->returnValue('git'));
|
||||||
|
|
|
@ -23,7 +23,7 @@ class CompletePackageTest extends TestCase
|
||||||
*
|
*
|
||||||
* demonstrates several versioning schemes
|
* demonstrates several versioning schemes
|
||||||
*/
|
*/
|
||||||
public function providerVersioningSchemes()
|
public function providerVersioningSchemes(): array
|
||||||
{
|
{
|
||||||
$provider[] = array('foo', '1-beta');
|
$provider[] = array('foo', '1-beta');
|
||||||
$provider[] = array('node', '0.5.6');
|
$provider[] = array('node', '0.5.6');
|
||||||
|
|
|
@ -111,7 +111,7 @@ class ArrayDumperTest extends TestCase
|
||||||
$this->assertSame($expectedValue ?: $value, $config[$key]);
|
$this->assertSame($expectedValue ?: $value, $config[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideKeys()
|
public function provideKeys(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
|
@ -247,8 +247,6 @@ class ArrayDumperTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
private function packageExpects($method, $value): \Composer\Test\Package\Dumper\ArrayDumperTest
|
private function packageExpects($method, $value): \Composer\Test\Package\Dumper\ArrayDumperTest
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,7 +84,7 @@ class ArrayLoaderTest extends TestCase
|
||||||
$this->assertEquals('1.2.3.4', $package->getVersion());
|
$this->assertEquals('1.2.3.4', $package->getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parseDumpProvider()
|
public function parseDumpProvider(): array
|
||||||
{
|
{
|
||||||
$validConfig = array(
|
$validConfig = array(
|
||||||
'name' => 'A/B',
|
'name' => 'A/B',
|
||||||
|
@ -273,7 +273,7 @@ class ArrayLoaderTest extends TestCase
|
||||||
$this->assertFalse($package->isAbandoned());
|
$this->assertFalse($package->isAbandoned());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function providePluginApiVersions()
|
public function providePluginApiVersions(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('1.0'),
|
array('1.0'),
|
||||||
|
|
|
@ -28,7 +28,7 @@ class RootPackageLoaderTest extends TestCase
|
||||||
*
|
*
|
||||||
* @return RootPackage|RootAliasPackage
|
* @return RootPackage|RootAliasPackage
|
||||||
*/
|
*/
|
||||||
protected function loadPackage($data)
|
protected function loadPackage($data): \Composer\Package\PackageInterface
|
||||||
{
|
{
|
||||||
$manager = $this->getMockBuilder('Composer\\Repository\\RepositoryManager')
|
$manager = $this->getMockBuilder('Composer\\Repository\\RepositoryManager')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
|
|
@ -35,7 +35,7 @@ class ValidatingArrayLoaderTest extends TestCase
|
||||||
$loader->load($config);
|
$loader->load($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function successProvider()
|
public function successProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array( // minimal
|
array( // minimal
|
||||||
|
@ -270,7 +270,7 @@ class ValidatingArrayLoaderTest extends TestCase
|
||||||
$loader->load($config);
|
$loader->load($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function errorProvider()
|
public function errorProvider(): array
|
||||||
{
|
{
|
||||||
$invalidNames = array(
|
$invalidNames = array(
|
||||||
'foo',
|
'foo',
|
||||||
|
@ -420,7 +420,7 @@ class ValidatingArrayLoaderTest extends TestCase
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function warningProvider()
|
public function warningProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -30,7 +30,7 @@ class VersionParserTest extends TestCase
|
||||||
$this->assertSame($result, $versionParser->parseNameVersionPairs($pairs));
|
$this->assertSame($result, $versionParser->parseNameVersionPairs($pairs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideParseNameVersionPairsData()
|
public function provideParseNameVersionPairsData(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(array('php:^7.0'), array(array('name' => 'php', 'version' => '^7.0'))),
|
array(array('php:^7.0'), array(array('name' => 'php', 'version' => '^7.0'))),
|
||||||
|
@ -53,7 +53,7 @@ class VersionParserTest extends TestCase
|
||||||
$this->assertSame($expected, VersionParser::isUpgrade($from, $to));
|
$this->assertSame($expected, VersionParser::isUpgrade($from, $to));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideIsUpgradeTests()
|
public function provideIsUpgradeTests(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('0.9.0.0', '1.0.0.0', true),
|
array('0.9.0.0', '1.0.0.0', true),
|
||||||
|
|
|
@ -317,7 +317,7 @@ class VersionSelectorTest extends TestCase
|
||||||
$this->assertSame($expectedVersion, $recommended);
|
$this->assertSame($expectedVersion, $recommended);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideRecommendedRequireVersionPackages()
|
public function provideRecommendedRequireVersionPackages(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
// real version, expected recommendation, [branch-alias], [pkg name]
|
// real version, expected recommendation, [branch-alias], [pkg name]
|
||||||
|
|
|
@ -27,7 +27,7 @@ class VersionTest extends TestCase
|
||||||
* 2) git log --pretty=%h --all -- crypto/opensslv.h include/openssl/opensslv.h | while read hash ; do (git show $hash:crypto/opensslv.h; git show $hash:include/openssl/opensslv.h) | grep "define OPENSSL_VERSION_TEXT" ; done > versions.txt
|
* 2) git log --pretty=%h --all -- crypto/opensslv.h include/openssl/opensslv.h | while read hash ; do (git show $hash:crypto/opensslv.h; git show $hash:include/openssl/opensslv.h) | grep "define OPENSSL_VERSION_TEXT" ; done > versions.txt
|
||||||
* 3) cat versions.txt | awk -F "OpenSSL " '{print $2}' | awk -F " " '{print $1}' | sed -e "s:\([0-9]*\.[0-9]*\.[0-9]*\):1.2.3:g" -e "s:1\.2\.3[a-z]\(-.*\)\{0,1\}$:1.2.3a\1:g" -e "s:1\.2\.3[a-z]\{2\}\(-.*\)\{0,1\}$:1.2.3zh\1:g" -e "s:beta[0-9]:beta3:g" -e "s:pre[0-9]*:pre2:g" | sort | uniq
|
* 3) cat versions.txt | awk -F "OpenSSL " '{print $2}' | awk -F " " '{print $1}' | sed -e "s:\([0-9]*\.[0-9]*\.[0-9]*\):1.2.3:g" -e "s:1\.2\.3[a-z]\(-.*\)\{0,1\}$:1.2.3a\1:g" -e "s:1\.2\.3[a-z]\{2\}\(-.*\)\{0,1\}$:1.2.3zh\1:g" -e "s:beta[0-9]:beta3:g" -e "s:pre[0-9]*:pre2:g" | sort | uniq
|
||||||
*/
|
*/
|
||||||
public static function provideOpenSslVersions()
|
public static function provideOpenSslVersions(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
// Generated
|
// Generated
|
||||||
|
@ -88,7 +88,7 @@ class VersionTest extends TestCase
|
||||||
self::assertSame($normalizedVersion, $this->getVersionParser()->normalize($parsedVersion));
|
self::assertSame($normalizedVersion, $this->getVersionParser()->normalize($parsedVersion));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideLibJpegVersions()
|
public function provideLibJpegVersions(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('9', '9.0'),
|
array('9', '9.0'),
|
||||||
|
@ -109,7 +109,7 @@ class VersionTest extends TestCase
|
||||||
self::assertSame($parsedVersion, Version::parseLibjpeg($input));
|
self::assertSame($parsedVersion, Version::parseLibjpeg($input));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideZoneinfoVersions()
|
public function provideZoneinfoVersions(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('2019c', '2019.3'),
|
array('2019c', '2019.3'),
|
||||||
|
|
|
@ -96,7 +96,7 @@ class PluginInstallerTest extends TestCase
|
||||||
$im = $this->getMockBuilder('Composer\Installer\InstallationManager')->disableOriginalConstructor()->getMock();
|
$im = $this->getMockBuilder('Composer\Installer\InstallationManager')->disableOriginalConstructor()->getMock();
|
||||||
$im->expects($this->any())
|
$im->expects($this->any())
|
||||||
->method('getInstallPath')
|
->method('getInstallPath')
|
||||||
->will($this->returnCallback(function ($package) {
|
->will($this->returnCallback(function ($package): string {
|
||||||
return __DIR__.'/Fixtures/'.$package->getPrettyName();
|
return __DIR__.'/Fixtures/'.$package->getPrettyName();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ class PluginInstallerTest extends TestCase
|
||||||
$this->repository
|
$this->repository
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getPackages')
|
->method('getPackages')
|
||||||
->will($this->returnCallback(function () use ($plugApiInternalPackage, $plugins) {
|
->will($this->returnCallback(function () use ($plugApiInternalPackage, $plugins): array {
|
||||||
return array_merge(array($plugApiInternalPackage), $plugins);
|
return array_merge(array($plugApiInternalPackage), $plugins);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ class PluginInstallerTest extends TestCase
|
||||||
|
|
||||||
$plugin->expects($this->once())
|
$plugin->expects($this->once())
|
||||||
->method('getCapabilities')
|
->method('getCapabilities')
|
||||||
->will($this->returnCallback(function () use ($capabilityImplementation, $capabilityApi) {
|
->will($this->returnCallback(function () use ($capabilityImplementation, $capabilityApi): array {
|
||||||
return array($capabilityApi => $capabilityImplementation);
|
return array($capabilityApi => $capabilityImplementation);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ class PluginInstallerTest extends TestCase
|
||||||
|
|
||||||
$plugin->expects($this->once())
|
$plugin->expects($this->once())
|
||||||
->method('getCapabilities')
|
->method('getCapabilities')
|
||||||
->will($this->returnCallback(function () use ($invalidImplementationClassNames, $capabilityApi) {
|
->will($this->returnCallback(function () use ($invalidImplementationClassNames, $capabilityApi): array {
|
||||||
return array($capabilityApi => $invalidImplementationClassNames);
|
return array($capabilityApi => $invalidImplementationClassNames);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ class PluginInstallerTest extends TestCase
|
||||||
|
|
||||||
$plugin->expects($this->once())
|
$plugin->expects($this->once())
|
||||||
->method('getCapabilities')
|
->method('getCapabilities')
|
||||||
->will($this->returnCallback(function () {
|
->will($this->returnCallback(function (): array {
|
||||||
return array();
|
return array();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class ArtifactRepositoryTest extends TestCase
|
||||||
|
|
||||||
$this->assertSame($expectedPackages, $foundPackages);
|
$this->assertSame($expectedPackages, $foundPackages);
|
||||||
|
|
||||||
$tarPackage = array_filter($repo->getPackages(), function (BasePackage $package) {
|
$tarPackage = array_filter($repo->getPackages(), function (BasePackage $package): bool {
|
||||||
return $package->getPrettyName() === 'test/jsonInRootTarFile';
|
return $package->getPrettyName() === 'test/jsonInRootTarFile';
|
||||||
});
|
});
|
||||||
$this->assertCount(1, $tarPackage);
|
$this->assertCount(1, $tarPackage);
|
||||||
|
|
|
@ -61,7 +61,7 @@ class ComposerRepositoryTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadDataProvider()
|
public function loadDataProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
// Old repository format
|
// Old repository format
|
||||||
|
@ -303,7 +303,7 @@ class ComposerRepositoryTest extends TestCase
|
||||||
$this->assertSame($expected, $method->invoke($repository, $url));
|
$this->assertSame($expected, $method->invoke($repository, $url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideCanonicalizeUrlTestCases()
|
public function provideCanonicalizeUrlTestCases(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -138,7 +138,7 @@ class CompositeRepositoryTest extends TestCase
|
||||||
$this->assertEquals(array(), call_user_func_array(array($repo, $method), $args));
|
$this->assertEquals(array(), call_user_func_array(array($repo, $method), $args));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideMethodCalls()
|
public function provideMethodCalls(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('findPackages', array('foo')),
|
array('findPackages', array('foo')),
|
||||||
|
|
|
@ -171,7 +171,7 @@ class FilesystemRepositoryTest extends TestCase
|
||||||
->getMock();
|
->getMock();
|
||||||
$im->expects($this->any())
|
$im->expects($this->any())
|
||||||
->method('getInstallPath')
|
->method('getInstallPath')
|
||||||
->will($this->returnCallback(function ($package) use ($dir) {
|
->will($this->returnCallback(function ($package) use ($dir): string {
|
||||||
// check for empty paths handling
|
// check for empty paths handling
|
||||||
if ($package->getType() === 'metapackage') {
|
if ($package->getType() === 'metapackage') {
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -45,12 +45,12 @@ class FilterRepositoryTest extends TestCase
|
||||||
$repo = new FilterRepository($this->arrayRepo, $config);
|
$repo = new FilterRepository($this->arrayRepo, $config);
|
||||||
$packages = $repo->getPackages();
|
$packages = $repo->getPackages();
|
||||||
|
|
||||||
$this->assertSame($expected, array_map(function ($p) {
|
$this->assertSame($expected, array_map(function ($p): string {
|
||||||
return $p->getName();
|
return $p->getName();
|
||||||
}, $packages));
|
}, $packages));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function provideRepoMatchingTestCases()
|
public static function provideRepoMatchingTestCases(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(array('foo/aaa', 'foo/bbb'), array('only' => array('foo/*'))),
|
array(array('foo/aaa', 'foo/bbb'), array('only' => array('foo/*'))),
|
||||||
|
|
|
@ -36,7 +36,7 @@ class PlatformRepositoryTest extends TestCase
|
||||||
self::assertSame('2.1.0', $hhvm->getPrettyVersion());
|
self::assertSame('2.1.0', $hhvm->getPrettyVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function providePhpFlavorTestCases()
|
public function providePhpFlavorTestCases(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
|
@ -128,7 +128,7 @@ class PlatformRepositoryTest extends TestCase
|
||||||
->willReturn(array());
|
->willReturn(array());
|
||||||
$runtime
|
$runtime
|
||||||
->method('hasConstant')
|
->method('hasConstant')
|
||||||
->willReturnCallback(function ($constant, $class = null) use ($constants) {
|
->willReturnCallback(function ($constant, $class = null) use ($constants): bool {
|
||||||
return isset($constants[ltrim($class.'::'.$constant, ':')]);
|
return isset($constants[ltrim($class.'::'.$constant, ':')]);
|
||||||
});
|
});
|
||||||
$runtime
|
$runtime
|
||||||
|
@ -178,7 +178,7 @@ class PlatformRepositoryTest extends TestCase
|
||||||
self::assertNull($package);
|
self::assertNull($package);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function provideLibraryTestCases()
|
public static function provideLibraryTestCases(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'amqp' => array(
|
'amqp' => array(
|
||||||
|
@ -1103,7 +1103,7 @@ Linked Version => 1.2.11',
|
||||||
$runtime
|
$runtime
|
||||||
->method('getExtensionVersion')
|
->method('getExtensionVersion')
|
||||||
->willReturnMap(
|
->willReturnMap(
|
||||||
array_map(function ($extension) use ($extensionVersion) {
|
array_map(function ($extension) use ($extensionVersion): array {
|
||||||
return array($extension, $extensionVersion);
|
return array($extension, $extensionVersion);
|
||||||
}, $extensions)
|
}, $extensions)
|
||||||
);
|
);
|
||||||
|
@ -1111,7 +1111,7 @@ Linked Version => 1.2.11',
|
||||||
$runtime
|
$runtime
|
||||||
->method('getExtensionInfo')
|
->method('getExtensionInfo')
|
||||||
->willReturnMap(
|
->willReturnMap(
|
||||||
array_map(function ($extension) use ($info) {
|
array_map(function ($extension) use ($info): array {
|
||||||
return array($extension, $info);
|
return array($extension, $info);
|
||||||
}, $extensions)
|
}, $extensions)
|
||||||
);
|
);
|
||||||
|
@ -1123,7 +1123,7 @@ Linked Version => 1.2.11',
|
||||||
$constants[] = array('PHP_VERSION', null, '7.1.0');
|
$constants[] = array('PHP_VERSION', null, '7.1.0');
|
||||||
$runtime
|
$runtime
|
||||||
->method('hasConstant')
|
->method('hasConstant')
|
||||||
->willReturnCallback(function ($constant, $class = null) use ($constants) {
|
->willReturnCallback(function ($constant, $class = null) use ($constants): bool {
|
||||||
foreach ($constants as $definition) {
|
foreach ($constants as $definition) {
|
||||||
if ($definition[0] === $constant && $definition[1] === $class) {
|
if ($definition[0] === $constant && $definition[1] === $class) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1138,7 +1138,7 @@ Linked Version => 1.2.11',
|
||||||
|
|
||||||
$runtime
|
$runtime
|
||||||
->method('hasClass')
|
->method('hasClass')
|
||||||
->willReturnCallback(function ($class) use ($classDefinitions) {
|
->willReturnCallback(function ($class) use ($classDefinitions): bool {
|
||||||
foreach ($classDefinitions as $definition) {
|
foreach ($classDefinitions as $definition) {
|
||||||
if ($definition[0] === $class) {
|
if ($definition[0] === $class) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1153,27 +1153,27 @@ Linked Version => 1.2.11',
|
||||||
|
|
||||||
$platformRepository = new PlatformRepository(array(), array(), $runtime);
|
$platformRepository = new PlatformRepository(array(), array(), $runtime);
|
||||||
|
|
||||||
$expectations = array_map(function ($expectation) {
|
$expectations = array_map(function ($expectation): array {
|
||||||
return array_replace(array(null, array(), array()), (array) $expectation);
|
return array_replace(array(null, array(), array()), (array) $expectation);
|
||||||
}, $expectations);
|
}, $expectations);
|
||||||
|
|
||||||
$libraries = array_map(
|
$libraries = array_map(
|
||||||
function ($package) {
|
function ($package): string {
|
||||||
return $package['name'];
|
return $package['name'];
|
||||||
},
|
},
|
||||||
array_filter(
|
array_filter(
|
||||||
$platformRepository->search('lib', PlatformRepository::SEARCH_NAME),
|
$platformRepository->search('lib', PlatformRepository::SEARCH_NAME),
|
||||||
function ($package) {
|
function ($package): bool {
|
||||||
return strpos($package['name'], 'lib-') === 0;
|
return strpos($package['name'], 'lib-') === 0;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$expectedLibraries = array_merge(array_keys(array_filter($expectations, function ($expectation) {
|
$expectedLibraries = array_merge(array_keys(array_filter($expectations, function ($expectation): bool {
|
||||||
return $expectation[0] !== false;
|
return $expectation[0] !== false;
|
||||||
})));
|
})));
|
||||||
self::assertCount(count(array_filter($expectedLibraries)), $libraries, sprintf('Expected: %s, got %s', var_export($expectedLibraries, true), var_export($libraries, true)));
|
self::assertCount(count(array_filter($expectedLibraries)), $libraries, sprintf('Expected: %s, got %s', var_export($expectedLibraries, true), var_export($libraries, true)));
|
||||||
|
|
||||||
$expectations = array_merge($expectations, array_combine(array_map(function ($extension) {
|
$expectations = array_merge($expectations, array_combine(array_map(function ($extension): string {
|
||||||
return 'ext-'.$extension;
|
return 'ext-'.$extension;
|
||||||
}, $extensions), array_fill(0, count($extensions), array($extensionVersion, array(), array()))));
|
}, $extensions), array_fill(0, count($extensions), array($extensionVersion, array(), array()))));
|
||||||
|
|
||||||
|
@ -1231,7 +1231,7 @@ Linked Version => 1.2.11',
|
||||||
self::assertNotNull($package, 'Composer package exists');
|
self::assertNotNull($package, 'Composer package exists');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function providePlatformPackages()
|
public static function providePlatformPackages(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('php', true),
|
array('php', true),
|
||||||
|
|
|
@ -63,7 +63,7 @@ class RepositoryFactoryTest extends TestCase
|
||||||
$this->assertSame($expected, RepositoryFactory::generateRepositoryName($index, $config, $existingRepos));
|
$this->assertSame($expected, RepositoryFactory::generateRepositoryName($index, $config, $existingRepos));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateRepositoryNameProvider()
|
public function generateRepositoryNameProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(0, array(), array(), '0'),
|
array(0, array(), array(), '0'),
|
||||||
|
|
|
@ -76,7 +76,7 @@ class RepositoryManagerTest extends TestCase
|
||||||
$config
|
$config
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('get')
|
->method('get')
|
||||||
->will($this->returnCallback(function ($arg) use ($tmpdir) {
|
->will($this->returnCallback(function ($arg) use ($tmpdir): ?string {
|
||||||
return 'cache-repo-dir' === $arg ? $tmpdir : null;
|
return 'cache-repo-dir' === $arg ? $tmpdir : null;
|
||||||
}))
|
}))
|
||||||
;
|
;
|
||||||
|
@ -95,7 +95,7 @@ class RepositoryManagerTest extends TestCase
|
||||||
$this->assertInstanceOf('Composer\Repository\RepositoryInterface', $rm->createRepository($type, $options));
|
$this->assertInstanceOf('Composer\Repository\RepositoryInterface', $rm->createRepository($type, $options));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideRepoCreationTestCases()
|
public function provideRepoCreationTestCases(): array
|
||||||
{
|
{
|
||||||
$cases = array(
|
$cases = array(
|
||||||
array('composer', array('url' => 'http://example.org')),
|
array('composer', array('url' => 'http://example.org')),
|
||||||
|
|
|
@ -46,7 +46,7 @@ class FossilDriverTest extends TestCase
|
||||||
$fs->removeDirectory($this->home);
|
$fs->removeDirectory($this->home);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function supportProvider()
|
public static function supportProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('http://fossil.kd2.org/kd2fw/', true),
|
array('http://fossil.kd2.org/kd2fw/', true),
|
||||||
|
|
|
@ -99,7 +99,7 @@ class GitBitbucketDriverTest extends TestCase
|
||||||
$driver->getRootIdentifier();
|
$driver->getRootIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDriver()
|
public function testDriver(): \Composer\Repository\Vcs\GitBitbucketDriver
|
||||||
{
|
{
|
||||||
$driver = $this->getDriver(array('url' => 'https://bitbucket.org/user/repo.git'));
|
$driver = $this->getDriver(array('url' => 'https://bitbucket.org/user/repo.git'));
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ class GitLabDriverTest extends TestCase
|
||||||
$fs->removeDirectory($this->home);
|
$fs->removeDirectory($this->home);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideInitializeUrls()
|
public function provideInitializeUrls(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject'),
|
array('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject'),
|
||||||
|
@ -92,7 +92,7 @@ class GitLabDriverTest extends TestCase
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @param string $apiUrl
|
* @param string $apiUrl
|
||||||
*/
|
*/
|
||||||
public function testInitialize($url, $apiUrl)
|
public function testInitialize($url, $apiUrl): \Composer\Repository\Vcs\GitLabDriver
|
||||||
{
|
{
|
||||||
// @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
|
// @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
|
||||||
$projectData = <<<JSON
|
$projectData = <<<JSON
|
||||||
|
@ -135,7 +135,7 @@ JSON;
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @param string $apiUrl
|
* @param string $apiUrl
|
||||||
*/
|
*/
|
||||||
public function testInitializePublicProject($url, $apiUrl)
|
public function testInitializePublicProject($url, $apiUrl): \Composer\Repository\Vcs\GitLabDriver
|
||||||
{
|
{
|
||||||
// @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
|
// @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
|
||||||
$projectData = <<<JSON
|
$projectData = <<<JSON
|
||||||
|
@ -176,7 +176,7 @@ JSON;
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @param string $apiUrl
|
* @param string $apiUrl
|
||||||
*/
|
*/
|
||||||
public function testInitializePublicProjectAsAnonymous($url, $apiUrl)
|
public function testInitializePublicProjectAsAnonymous($url, $apiUrl): \Composer\Repository\Vcs\GitLabDriver
|
||||||
{
|
{
|
||||||
// @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
|
// @link http://doc.gitlab.com/ce/api/projects.html#get-single-project
|
||||||
$projectData = <<<JSON
|
$projectData = <<<JSON
|
||||||
|
@ -449,7 +449,7 @@ JSON;
|
||||||
$this->assertSame($expected, GitLabDriver::supports($this->io, $this->config, $url));
|
$this->assertSame($expected, GitLabDriver::supports($this->io, $this->config, $url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataForTestSupports()
|
public function dataForTestSupports(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('http://gitlab.com/foo/bar', true),
|
array('http://gitlab.com/foo/bar', true),
|
||||||
|
|
|
@ -57,7 +57,7 @@ class HgDriverTest extends TestCase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supportsDataProvider()
|
public function supportsDataProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('ssh://bitbucket.org/user/repo'),
|
array('ssh://bitbucket.org/user/repo'),
|
||||||
|
|
|
@ -84,7 +84,7 @@ class SvnDriverTest extends TestCase
|
||||||
$svn->initialize();
|
$svn->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function supportProvider()
|
public static function supportProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('http://svn.apache.org', true),
|
array('http://svn.apache.org', true),
|
||||||
|
|
|
@ -135,7 +135,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
|
||||||
* @param string $version
|
* @param string $version
|
||||||
* @return AliasPackage|RootAliasPackage|CompleteAliasPackage
|
* @return AliasPackage|RootAliasPackage|CompleteAliasPackage
|
||||||
*/
|
*/
|
||||||
protected function getAliasPackage(Package $package, $version)
|
protected function getAliasPackage(Package $package, $version): \Composer\Package\AliasPackage
|
||||||
{
|
{
|
||||||
$normVersion = self::getVersionParser()->normalize($version);
|
$normVersion = self::getVersionParser()->normalize($version);
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ class AuthHelperTest extends TestCase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function gitlabPrivateTokenProvider()
|
public function gitlabPrivateTokenProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('private-token'),
|
array('private-token'),
|
||||||
|
@ -222,7 +222,7 @@ class AuthHelperTest extends TestCase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bitbucketPublicUrlProvider()
|
public function bitbucketPublicUrlProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('https://bitbucket.org/user/repo/downloads/whatever'),
|
array('https://bitbucket.org/user/repo/downloads/whatever'),
|
||||||
|
@ -260,7 +260,7 @@ class AuthHelperTest extends TestCase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function basicHttpAuthenticationProvider()
|
public function basicHttpAuthenticationProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
|
@ -416,7 +416,7 @@ class AuthHelperTest extends TestCase
|
||||||
null,
|
null,
|
||||||
'y'
|
'y'
|
||||||
)
|
)
|
||||||
->willReturnCallback(function ($question, $validator, $attempts, $default) use ($answer) {
|
->willReturnCallback(function ($question, $validator, $attempts, $default) use ($answer): string {
|
||||||
$validator($answer);
|
$validator($answer);
|
||||||
|
|
||||||
return $answer;
|
return $answer;
|
||||||
|
@ -464,7 +464,7 @@ class AuthHelperTest extends TestCase
|
||||||
null,
|
null,
|
||||||
'y'
|
'y'
|
||||||
)
|
)
|
||||||
->willReturnCallback(function ($question, $validator, $attempts, $default) use ($answer) {
|
->willReturnCallback(function ($question, $validator, $attempts, $default) use ($answer): string {
|
||||||
$validator($answer);
|
$validator($answer);
|
||||||
|
|
||||||
return $answer;
|
return $answer;
|
||||||
|
@ -504,7 +504,7 @@ class AuthHelperTest extends TestCase
|
||||||
null,
|
null,
|
||||||
'y'
|
'y'
|
||||||
)
|
)
|
||||||
->willReturnCallback(function ($question, $validator, $attempts, $default) use ($answer) {
|
->willReturnCallback(function ($question, $validator, $attempts, $default) use ($answer): string {
|
||||||
$validator($answer);
|
$validator($answer);
|
||||||
|
|
||||||
return $answer;
|
return $answer;
|
||||||
|
|
|
@ -111,7 +111,7 @@ class BitbucketTest extends TestCase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequestAccessTokenWithValidOAuthConsumerAndValidStoredAccessToken()
|
public function testRequestAccessTokenWithValidOAuthConsumerAndValidStoredAccessToken(): \Composer\Util\Bitbucket
|
||||||
{
|
{
|
||||||
$this->config->expects($this->once())
|
$this->config->expects($this->once())
|
||||||
->method('get')
|
->method('get')
|
||||||
|
|
|
@ -65,7 +65,7 @@ class FilesystemTest extends TestCase
|
||||||
$this->assertEquals($expected, $fs->findShortestPathCode($a, $b, $directory, $static));
|
$this->assertEquals($expected, $fs->findShortestPathCode($a, $b, $directory, $static));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function providePathCouplesAsCode()
|
public function providePathCouplesAsCode(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('/foo/bar', '/foo/bar', false, "__FILE__"),
|
array('/foo/bar', '/foo/bar', false, "__FILE__"),
|
||||||
|
@ -128,7 +128,7 @@ class FilesystemTest extends TestCase
|
||||||
$this->assertEquals($expected, $fs->findShortestPath($a, $b, $directory));
|
$this->assertEquals($expected, $fs->findShortestPath($a, $b, $directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function providePathCouples()
|
public function providePathCouples(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('/foo/bar', '/foo/bar', "./bar"),
|
array('/foo/bar', '/foo/bar', "./bar"),
|
||||||
|
@ -213,7 +213,7 @@ class FilesystemTest extends TestCase
|
||||||
$this->assertEquals($expected, $fs->normalizePath($actual));
|
$this->assertEquals($expected, $fs->normalizePath($actual));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideNormalizedPaths()
|
public function provideNormalizedPaths(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('../foo', '../foo'),
|
array('../foo', '../foo'),
|
||||||
|
|
|
@ -49,7 +49,7 @@ class GitTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function testRunCommandPublicGitHubRepositoryNotInitialClone($protocol, $expectedUrl): void
|
public function testRunCommandPublicGitHubRepositoryNotInitialClone($protocol, $expectedUrl): void
|
||||||
{
|
{
|
||||||
$commandCallable = function ($url) use ($expectedUrl) {
|
$commandCallable = function ($url) use ($expectedUrl): string {
|
||||||
$this->assertSame($expectedUrl, $url);
|
$this->assertSame($expectedUrl, $url);
|
||||||
|
|
||||||
return 'git command';
|
return 'git command';
|
||||||
|
@ -62,7 +62,7 @@ class GitTest extends TestCase
|
||||||
$this->git->runCommand($commandCallable, 'https://github.com/acme/repo', null, true);
|
$this->git->runCommand($commandCallable, 'https://github.com/acme/repo', null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function publicGithubNoCredentialsProvider()
|
public function publicGithubNoCredentialsProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('ssh', 'git@github.com:acme/repo'),
|
array('ssh', 'git@github.com:acme/repo'),
|
||||||
|
@ -74,7 +74,7 @@ class GitTest extends TestCase
|
||||||
{
|
{
|
||||||
self::expectException('RuntimeException');
|
self::expectException('RuntimeException');
|
||||||
|
|
||||||
$commandCallable = function ($url) {
|
$commandCallable = function ($url): string {
|
||||||
$this->assertSame('https://github.com/acme/repo', $url);
|
$this->assertSame('https://github.com/acme/repo', $url);
|
||||||
|
|
||||||
return 'git command';
|
return 'git command';
|
||||||
|
@ -101,7 +101,7 @@ class GitTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function testRunCommandPrivateGitHubRepositoryNotInitialCloneNotInteractiveWithAuthentication($gitUrl, $protocol, $gitHubToken, $expectedUrl, $expectedFailuresBeforeSuccess): void
|
public function testRunCommandPrivateGitHubRepositoryNotInitialCloneNotInteractiveWithAuthentication($gitUrl, $protocol, $gitHubToken, $expectedUrl, $expectedFailuresBeforeSuccess): void
|
||||||
{
|
{
|
||||||
$commandCallable = function ($url) use ($expectedUrl) {
|
$commandCallable = function ($url) use ($expectedUrl): string {
|
||||||
if ($url !== $expectedUrl) {
|
if ($url !== $expectedUrl) {
|
||||||
return 'git command failing';
|
return 'git command failing';
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ class GitTest extends TestCase
|
||||||
$this->git->runCommand($commandCallable, $gitUrl, null, true);
|
$this->git->runCommand($commandCallable, $gitUrl, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function privateGithubWithCredentialsProvider()
|
public function privateGithubWithCredentialsProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('git@github.com:acme/repo.git', 'ssh', 'MY_GITHUB_TOKEN', 'https://token:MY_GITHUB_TOKEN@github.com/acme/repo.git', 1),
|
array('git@github.com:acme/repo.git', 'ssh', 'MY_GITHUB_TOKEN', 'https://token:MY_GITHUB_TOKEN@github.com/acme/repo.git', 1),
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ProxyHelperTest extends TestCase
|
||||||
ProxyHelper::getProxyData();
|
ProxyHelper::getProxyData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataMalformed()
|
public function dataMalformed(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'no-host' => array('localhost'),
|
'no-host' => array('localhost'),
|
||||||
|
@ -79,7 +79,7 @@ class ProxyHelperTest extends TestCase
|
||||||
$this->assertSame($expected, $httpProxy);
|
$this->assertSame($expected, $httpProxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataFormatting()
|
public function dataFormatting(): array
|
||||||
{
|
{
|
||||||
// url, expected
|
// url, expected
|
||||||
return array(
|
return array(
|
||||||
|
@ -104,7 +104,7 @@ class ProxyHelperTest extends TestCase
|
||||||
$this->assertSame($expected, $list[$index]);
|
$this->assertSame($expected, $list[$index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataCaseOverrides()
|
public function dataCaseOverrides(): array
|
||||||
{
|
{
|
||||||
// server, expected, list index
|
// server, expected, list index
|
||||||
return array(
|
return array(
|
||||||
|
@ -129,7 +129,7 @@ class ProxyHelperTest extends TestCase
|
||||||
$this->assertSame($expected, $list[$index]);
|
$this->assertSame($expected, $list[$index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataCGIOverrides()
|
public function dataCGIOverrides(): array
|
||||||
{
|
{
|
||||||
// server, expected, list index
|
// server, expected, list index
|
||||||
return array(
|
return array(
|
||||||
|
@ -167,7 +167,7 @@ class ProxyHelperTest extends TestCase
|
||||||
$this->assertEquals($expected, ProxyHelper::getContextOptions($url));
|
$this->assertEquals($expected, ProxyHelper::getContextOptions($url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataContextOptions()
|
public function dataContextOptions(): array
|
||||||
{
|
{
|
||||||
// url, expected
|
// url, expected
|
||||||
return array(
|
return array(
|
||||||
|
@ -198,7 +198,7 @@ class ProxyHelperTest extends TestCase
|
||||||
$this->assertEquals($expected, $options);
|
$this->assertEquals($expected, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataRequestFullUri()
|
public function dataRequestFullUri(): array
|
||||||
{
|
{
|
||||||
$options = array('http' => array('request_fulluri' => true));
|
$options = array('http' => array('request_fulluri' => true));
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ class ProxyManagerTest extends TestCase
|
||||||
$this->assertTrue($condition, 'lastProxy check');
|
$this->assertTrue($condition, 'lastProxy check');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataRequest()
|
public function dataRequest(): array
|
||||||
{
|
{
|
||||||
$server = array(
|
$server = array(
|
||||||
'http_proxy' => 'http://user:p%40ss@proxy.com',
|
'http_proxy' => 'http://user:p%40ss@proxy.com',
|
||||||
|
@ -156,7 +156,7 @@ class ProxyManagerTest extends TestCase
|
||||||
$this->assertTrue($condition, 'message check');
|
$this->assertTrue($condition, 'message check');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataStatus()
|
public function dataStatus(): array
|
||||||
{
|
{
|
||||||
// server, expectedStatus, expectedMessage
|
// server, expectedStatus, expectedMessage
|
||||||
return array(
|
return array(
|
||||||
|
|
|
@ -30,7 +30,7 @@ class RequestProxyTest extends TestCase
|
||||||
$this->assertSame($expectedSecure, $proxy->isSecure());
|
$this->assertSame($expectedSecure, $proxy->isSecure());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataSecure()
|
public function dataSecure(): array
|
||||||
{
|
{
|
||||||
// url, secure
|
// url, secure
|
||||||
return array(
|
return array(
|
||||||
|
@ -55,7 +55,7 @@ class RequestProxyTest extends TestCase
|
||||||
$this->assertSame($expected, $message);
|
$this->assertSame($expected, $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataProxyUrl()
|
public function dataProxyUrl(): array
|
||||||
{
|
{
|
||||||
$format = 'proxy (%s)';
|
$format = 'proxy (%s)';
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class NoProxyPatternTest extends TestCase
|
||||||
$this->assertEquals($expected, $matcher->test($url));
|
$this->assertEquals($expected, $matcher->test($url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataHostName()
|
public function dataHostName(): array
|
||||||
{
|
{
|
||||||
$noproxy = 'foobar.com, .barbaz.net';
|
$noproxy = 'foobar.com, .barbaz.net';
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class NoProxyPatternTest extends TestCase
|
||||||
$this->assertEquals($expected, $matcher->test($url));
|
$this->assertEquals($expected, $matcher->test($url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataIpAddress()
|
public function dataIpAddress(): array
|
||||||
{
|
{
|
||||||
$noproxy = '192.168.1.1, 2001:db8::52:0:1';
|
$noproxy = '192.168.1.1, 2001:db8::52:0:1';
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class NoProxyPatternTest extends TestCase
|
||||||
$this->assertEquals($expected, $matcher->test($url));
|
$this->assertEquals($expected, $matcher->test($url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataIpRange()
|
public function dataIpRange(): array
|
||||||
{
|
{
|
||||||
$noproxy = '10.0.0.0/30, 2002:db8:a::45/121';
|
$noproxy = '10.0.0.0/30, 2002:db8:a::45/121';
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ class NoProxyPatternTest extends TestCase
|
||||||
$this->assertEquals($expected, $matcher->test($url));
|
$this->assertEquals($expected, $matcher->test($url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataPort()
|
public function dataPort(): array
|
||||||
{
|
{
|
||||||
$noproxy = '192.168.1.2:81, 192.168.1.3:80, [2001:db8::52:0:2]:443, [2001:db8::52:0:3]:80';
|
$noproxy = '192.168.1.2:81, 192.168.1.3:80, [2001:db8::52:0:2]:443, [2001:db8::52:0:3]:80';
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class PackageSorterTest extends TestCase
|
||||||
self::assertSame($packages, $sortedPackages);
|
self::assertSame($packages, $sortedPackages);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sortingOrdersDependenciesHigherThanPackageDataProvider()
|
public function sortingOrdersDependenciesHigherThanPackageDataProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'one package is dep' => array(
|
'one package is dep' => array(
|
||||||
|
@ -111,7 +111,7 @@ class PackageSorterTest extends TestCase
|
||||||
public function testSortingOrdersDependenciesHigherThanPackage($packages, $expectedOrderedList): void
|
public function testSortingOrdersDependenciesHigherThanPackage($packages, $expectedOrderedList): void
|
||||||
{
|
{
|
||||||
$sortedPackages = PackageSorter::sortPackages($packages);
|
$sortedPackages = PackageSorter::sortPackages($packages);
|
||||||
$sortedPackageNames = array_map(function ($package) {
|
$sortedPackageNames = array_map(function ($package): string {
|
||||||
return $package->getName();
|
return $package->getName();
|
||||||
}, $sortedPackages);
|
}, $sortedPackages);
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ class ProcessExecutorTest extends TestCase
|
||||||
$this->assertEquals('Executing command (CWD): ' . $expectedCommandOutput, trim($buffer->getOutput()));
|
$this->assertEquals('Executing command (CWD): ' . $expectedCommandOutput, trim($buffer->getOutput()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hidePasswordProvider()
|
public function hidePasswordProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('echo https://foo:bar@example.org/', 'echo https://foo:***@example.org/'),
|
array('echo https://foo:bar@example.org/', 'echo https://foo:***@example.org/'),
|
||||||
|
@ -151,7 +151,7 @@ class ProcessExecutorTest extends TestCase
|
||||||
* Each named test is an array of:
|
* Each named test is an array of:
|
||||||
* argument, win-expected, unix-expected
|
* argument, win-expected, unix-expected
|
||||||
*/
|
*/
|
||||||
public function dataEscapeArguments()
|
public function dataEscapeArguments(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
// empty argument - must be quoted
|
// empty argument - must be quoted
|
||||||
|
|
|
@ -176,7 +176,7 @@ class RemoteFilesystemTest extends TestCase
|
||||||
$fs = $this->getRemoteFilesystemWithMockedMethods(array('getRemoteContents'));
|
$fs = $this->getRemoteFilesystemWithMockedMethods(array('getRemoteContents'));
|
||||||
|
|
||||||
$fs->expects($this->once())->method('getRemoteContents')
|
$fs->expects($this->once())->method('getRemoteContents')
|
||||||
->willReturnCallback(function ($originUrl, $fileUrl, $ctx, &$http_response_header) {
|
->willReturnCallback(function ($originUrl, $fileUrl, $ctx, &$http_response_header): string {
|
||||||
$http_response_header = array('http/1.1 401 unauthorized');
|
$http_response_header = array('http/1.1 401 unauthorized');
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
@ -313,7 +313,7 @@ class RemoteFilesystemTest extends TestCase
|
||||||
$domains = array();
|
$domains = array();
|
||||||
$io
|
$io
|
||||||
->method('hasAuthentication')
|
->method('hasAuthentication')
|
||||||
->willReturnCallback(function ($arg) use (&$domains) {
|
->willReturnCallback(function ($arg) use (&$domains): bool {
|
||||||
$domains[] = $arg;
|
$domains[] = $arg;
|
||||||
// first time is called with bitbucket.org, then it redirects to bbuseruploads.s3.amazonaws.com so next time we have no auth configured
|
// first time is called with bitbucket.org, then it redirects to bbuseruploads.s3.amazonaws.com so next time we have no auth configured
|
||||||
return $arg === 'bitbucket.org';
|
return $arg === 'bitbucket.org';
|
||||||
|
|
|
@ -49,7 +49,7 @@ class StreamContextFactoryTest extends TestCase
|
||||||
$this->assertEquals($expectedParams, $params);
|
$this->assertEquals($expectedParams, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataGetContext()
|
public function dataGetContext(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
|
@ -192,7 +192,7 @@ class StreamContextFactoryTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataSSLProxy()
|
public function dataSSLProxy(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('ssl://proxyserver:443', 'https://proxyserver/'),
|
array('ssl://proxyserver:443', 'https://proxyserver/'),
|
||||||
|
|
|
@ -36,7 +36,7 @@ class SvnTest extends TestCase
|
||||||
$this->assertEquals($expect, $reflMethod->invoke($svn));
|
$this->assertEquals($expect, $reflMethod->invoke($svn));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function urlProvider()
|
public function urlProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('http://till:test@svn.example.org/', $this->getCmd(" --username 'till' --password 'test' ")),
|
array('http://till:test@svn.example.org/', $this->getCmd(" --username 'till' --password 'test' ")),
|
||||||
|
|
|
@ -41,7 +41,7 @@ class TlsHelperTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataCheckCertificateHost()
|
public function dataCheckCertificateHost(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(true, 'getcomposer.org', array('getcomposer.org')),
|
array(true, 'getcomposer.org', array('getcomposer.org')),
|
||||||
|
|
|
@ -34,7 +34,7 @@ class UrlTest extends TestCase
|
||||||
$this->assertSame($expectedUrl, Url::updateDistReference($config, $url, $ref));
|
$this->assertSame($expectedUrl, Url::updateDistReference($config, $url, $ref));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function distRefsProvider()
|
public static function distRefsProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
// github
|
// github
|
||||||
|
@ -75,7 +75,7 @@ class UrlTest extends TestCase
|
||||||
$this->assertSame($expected, Url::sanitize($url));
|
$this->assertSame($expected, Url::sanitize($url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function sanitizeProvider()
|
public static function sanitizeProvider(): array
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
// with scheme
|
// with scheme
|
||||||
|
|
Loading…
Reference in New Issue