From 71681c2f04d46af96460e546daef35ffcfb9d266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pluchino?= Date: Thu, 8 Aug 2019 16:40:55 +0200 Subject: [PATCH] Update php code style --- Tests/AssetsTest.php | 14 +- Tests/Composer/ScriptHandlerTest.php | 54 +- Tests/Config/ConfigTest.php | 30 +- .../AbstractPackageConverterTest.php | 30 +- Tests/Converter/BowerPackageConverterTest.php | 74 +-- Tests/Converter/NpmPackageConverterTest.php | 148 +++--- Tests/Converter/NpmPackageUtilTest.php | 6 +- Tests/Converter/SemverConverterTest.php | 6 +- Tests/FxpAssetPluginTest.php | 148 +++--- Tests/Installer/AssetInstallerTest.php | 66 +-- Tests/Installer/BowerInstallerTest.php | 116 ++--- Tests/Installer/IgnoreFactoryTest.php | 60 +-- Tests/Installer/IgnoreManagerTest.php | 184 +++---- Tests/Package/LazyCompletePackageTest.php | 78 +-- .../Loader/LazyAssetPackageLoaderTest.php | 128 ++--- .../AbstractAssetsRepositoryTest.php | 102 ++-- .../Repository/AssetRepositoryManagerTest.php | 12 +- Tests/Repository/AssetVcsRepositoryTest.php | 48 +- .../Repository/BowerPrivateRepositoryTest.php | 4 +- Tests/Repository/NpmRepositoryTest.php | 62 +-- Tests/Repository/ResolutionManagerTest.php | 2 +- Tests/Repository/UtilTest.php | 2 +- .../Repository/Vcs/GitBitbucketDriverTest.php | 32 +- Tests/Repository/Vcs/GitDriverTest.php | 66 +-- Tests/Repository/Vcs/GitHubDriverTest.php | 478 +++++++++--------- .../Repository/Vcs/HgBitbucketDriverTest.php | 28 +- Tests/Repository/Vcs/HgDriverTest.php | 44 +- Tests/Repository/Vcs/PerforceDriverTest.php | 48 +- Tests/Repository/Vcs/SvnDriverTest.php | 84 +-- Tests/Repository/Vcs/UtilTest.php | 2 +- Tests/Repository/VcsPackageFilterTest.php | 60 +-- Tests/TestCase.php | 2 +- Tests/Type/AbstractAssetTypeTest.php | 4 +- Tests/Type/BowerAssetTypeTest.php | 12 +- Tests/Type/NpmAssetTypeTest.php | 12 +- Tests/Util/PerforceTest.php | 178 +++---- Tests/Util/ValidatorTest.php | 8 +- 37 files changed, 1208 insertions(+), 1224 deletions(-) diff --git a/Tests/AssetsTest.php b/Tests/AssetsTest.php index c0c3663f..6bf2b955 100644 --- a/Tests/AssetsTest.php +++ b/Tests/AssetsTest.php @@ -24,7 +24,7 @@ final class AssetsTest extends \PHPUnit\Framework\TestCase { public function testGetTypes() { - $this->assertEquals(array( + static::assertEquals(array( 'npm', 'bower', ), Assets::getTypes()); @@ -32,7 +32,7 @@ public function testGetTypes() public function testDefaultGetRegistries() { - $this->assertEquals(array( + static::assertEquals(array( 'npm', 'bower', ), array_keys(Assets::getDefaultRegistries())); @@ -40,7 +40,7 @@ public function testDefaultGetRegistries() public function testGetVcsRepositoryDrivers() { - $this->assertEquals(array( + static::assertEquals(array( 'vcs', 'github', 'git-bitbucket', @@ -55,7 +55,7 @@ public function testGetVcsRepositoryDrivers() public function testGetVcsDrivers() { - $this->assertEquals(array( + static::assertEquals(array( 'github', 'git-bitbucket', 'git', @@ -79,20 +79,20 @@ public function testCreationOfNpmAsset() { $type = Assets::createType('npm'); - $this->assertInstanceOf('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface', $type); + static::assertInstanceOf('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface', $type); } public function testCreationOfBowerAsset() { $type = Assets::createType('bower'); - $this->assertInstanceOf('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface', $type); + static::assertInstanceOf('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface', $type); } public function testCreationOfPrivateBowerAsset() { $type = Assets::createType('bower'); - $this->assertInstanceOf('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface', $type); + static::assertInstanceOf('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface', $type); } } diff --git a/Tests/Composer/ScriptHandlerTest.php b/Tests/Composer/ScriptHandlerTest.php index df80d276..5096f266 100644 --- a/Tests/Composer/ScriptHandlerTest.php +++ b/Tests/Composer/ScriptHandlerTest.php @@ -68,9 +68,9 @@ protected function setUp() $this->package = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $this->config = $this->getMockBuilder('Composer\Config')->getMock(); - $this->config->expects($this->any()) + $this->config->expects(static::any()) ->method('get') - ->will($this->returnCallback(function ($key) { + ->willReturnCallback(function ($key) { $val = null; switch ($key) { @@ -81,35 +81,35 @@ protected function setUp() } return $val; - })) + }) ; $rootPackage = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock(); - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getConfig') - ->will($this->returnValue($this->config)) + ->willReturn($this->config) ; - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getPackage') - ->will($this->returnValue($rootPackage)) + ->willReturn($rootPackage) ; $plugin = $this->getMockBuilder(FxpAssetPlugin::class)->disableOriginalConstructor()->getMock(); - $plugin->expects($this->any()) + $plugin->expects(static::any()) ->method('getConfig') ->willReturn(new Config(array())) ; $pm = $this->getMockBuilder(PluginManager::class)->disableOriginalConstructor()->getMock(); - $pm->expects($this->any()) + $pm->expects(static::any()) ->method('getPlugins') ->willReturn(array($plugin)) ; - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getPluginManager') - ->will($this->returnValue($pm)) + ->willReturn($pm) ; } @@ -138,7 +138,7 @@ public function getPackageComposerTypes() public function testDeleteIgnoreFiles($composerType) { $this->operation = $this->getMockBuilder('Composer\DependencyResolver\Operation\OperationInterface')->getMock(); - $this->assertInstanceOf('Composer\DependencyResolver\Operation\OperationInterface', $this->operation); + static::assertInstanceOf('Composer\DependencyResolver\Operation\OperationInterface', $this->operation); ScriptHandler::deleteIgnoredFiles($this->createEvent($composerType)); } @@ -154,7 +154,7 @@ public function testDeleteIgnoreFilesWithInstallOperation($composerType) ->disableOriginalConstructor() ->getMock() ; - $this->assertInstanceOf('Composer\DependencyResolver\Operation\OperationInterface', $this->operation); + static::assertInstanceOf('Composer\DependencyResolver\Operation\OperationInterface', $this->operation); ScriptHandler::deleteIgnoredFiles($this->createEvent($composerType)); } @@ -170,7 +170,7 @@ public function testDeleteIgnoreFilesWithUpdateOperation($composerType) ->disableOriginalConstructor() ->getMock() ; - $this->assertInstanceOf('Composer\DependencyResolver\Operation\OperationInterface', $this->operation); + static::assertInstanceOf('Composer\DependencyResolver\Operation\OperationInterface', $this->operation); ScriptHandler::deleteIgnoredFiles($this->createEvent($composerType)); } @@ -188,24 +188,24 @@ public function testGetConfig($composerType) $rootPackage = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock(); $this->composer = $this->getMockBuilder('Composer\Composer')->getMock(); - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getConfig') - ->will($this->returnValue($this->config)) + ->willReturn($this->config) ; - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getPackage') - ->will($this->returnValue($rootPackage)) + ->willReturn($rootPackage) ; $pm = $this->getMockBuilder(PluginManager::class)->disableOriginalConstructor()->getMock(); - $pm->expects($this->any()) + $pm->expects(static::any()) ->method('getPlugins') ->willReturn(array()) ; - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getPluginManager') - ->will($this->returnValue($pm)) + ->willReturn($pm) ; $this->operation = $this->getMockBuilder('Composer\DependencyResolver\Operation\OperationInterface')->getMock(); @@ -220,22 +220,22 @@ public function testGetConfig($composerType) */ protected function createEvent($composerType) { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getType') - ->will($this->returnValue($composerType)) + ->willReturn($composerType) ; if ($this->operation instanceof UpdateOperation) { - $this->operation->expects($this->any()) + $this->operation->expects(static::any()) ->method('getTargetPackage') - ->will($this->returnValue($this->package)) + ->willReturn($this->package) ; } if ($this->operation instanceof InstallOperation) { - $this->operation->expects($this->any()) + $this->operation->expects(static::any()) ->method('getPackage') - ->will($this->returnValue($this->package)) + ->willReturn($this->package) ; } diff --git a/Tests/Config/ConfigTest.php b/Tests/Config/ConfigTest.php index bd56672a..e5cf754f 100644 --- a/Tests/Config/ConfigTest.php +++ b/Tests/Config/ConfigTest.php @@ -53,12 +53,12 @@ protected function setUp() $this->io = $this->getMockBuilder(IOInterface::class)->getMock(); $this->package = $this->getMockBuilder(RootPackageInterface::class)->getMock(); - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getPackage') ->willReturn($this->package) ; - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getConfig') ->willReturn($this->composerConfig) ; @@ -98,19 +98,19 @@ public function testGetConfig($key, $expected, $default = null, $env = null) } $globalPath = realpath(__DIR__.'/../Fixtures/package/global'); - $this->composerConfig->expects($this->any()) + $this->composerConfig->expects(static::any()) ->method('has') ->with('home') ->willReturn(true) ; - $this->composerConfig->expects($this->any()) + $this->composerConfig->expects(static::any()) ->method('get') ->with('home') ->willReturn($globalPath) ; - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') ->willReturn(array( 'asset-baz' => false, @@ -118,7 +118,7 @@ public function testGetConfig($key, $expected, $default = null, $env = null) )) ; - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getConfig') ->willReturn(array( 'fxp-asset' => array( @@ -130,16 +130,16 @@ public function testGetConfig($key, $expected, $default = null, $env = null) ; if (0 === strpos($key, 'global-')) { - $this->io->expects($this->atLeast(2)) + $this->io->expects(static::atLeast(2)) ->method('isDebug') ->willReturn(true) ; - $this->io->expects($this->at(1)) + $this->io->expects(static::at(1)) ->method('writeError') ->with(sprintf('Loading fxp-asset config in file %s/composer.json', $globalPath)) ; - $this->io->expects($this->at(3)) + $this->io->expects(static::at(3)) ->method('writeError') ->with(sprintf('Loading fxp-asset config in file %s/config.json', $globalPath)) ; @@ -152,12 +152,12 @@ public function testGetConfig($key, $expected, $default = null, $env = null) if (null !== $env) { $envKey = substr($env, 0, strpos($env, '=')); putenv($envKey); - $this->assertFalse(getenv($envKey)); + static::assertFalse(getenv($envKey)); } - $this->assertSame($expected, $value); + static::assertSame($expected, $value); // test cache - $this->assertSame($expected, $config->get($key, $default)); + static::assertSame($expected, $config->get($key, $default)); } /** @@ -177,7 +177,7 @@ public function testGetEnvConfigWithInvalidJson() } putenv('FXP_ASSET__ENV_JSON'); - $this->assertFalse(getenv('FXP_ASSET__ENV_JSON')); + static::assertFalse(getenv('FXP_ASSET__ENV_JSON')); if (null === $ex) { throw new \Exception('The expected exception was not thrown'); @@ -201,13 +201,13 @@ public function testValidateConfig() 'asset-main-files' => 'deprecated', ); - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') ->willReturn($deprecated) ; foreach (array_keys($deprecated) as $i => $option) { - $this->io->expects($this->at($i)) + $this->io->expects(static::at($i)) ->method('write') ->with('The "extra.'.$option.'" option is deprecated, use the "config.fxp-asset.'.substr($option, 6).'" option') ; diff --git a/Tests/Converter/AbstractPackageConverterTest.php b/Tests/Converter/AbstractPackageConverterTest.php index 622de96a..f7b494bd 100644 --- a/Tests/Converter/AbstractPackageConverterTest.php +++ b/Tests/Converter/AbstractPackageConverterTest.php @@ -40,36 +40,36 @@ abstract class AbstractPackageConverterTest extends \PHPUnit\Framework\TestCase protected function setUp() { $versionConverter = $this->getMockBuilder('Fxp\Composer\AssetPlugin\Converter\VersionConverterInterface')->getMock(); - $versionConverter->expects($this->any()) + $versionConverter->expects(static::any()) ->method('convertVersion') - ->will($this->returnCallback(function ($value) { + ->willReturnCallback(function ($value) { return $value; - })) + }) ; - $versionConverter->expects($this->any()) + $versionConverter->expects(static::any()) ->method('convertRange') - ->will($this->returnCallback(function ($value) { + ->willReturnCallback(function ($value) { return $value; - })) + }) ; $type = $this->getMockBuilder('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface')->getMock(); - $type->expects($this->any()) + $type->expects(static::any()) ->method('getComposerVendorName') - ->will($this->returnValue('ASSET')) + ->willReturn('ASSET') ; - $type->expects($this->any()) + $type->expects(static::any()) ->method('getComposerType') - ->will($this->returnValue('ASSET_TYPE')) + ->willReturn('ASSET_TYPE') ; - $type->expects($this->any()) + $type->expects(static::any()) ->method('getVersionConverter') - ->will($this->returnValue($versionConverter)) + ->willReturn($versionConverter) ; - $type->expects($this->any()) + $type->expects(static::any()) ->method('formatComposerName') - ->will($this->returnCallback(function ($value) { + ->willReturnCallback(function ($value) { return 'ASSET/'.$value; - })) + }) ; $this->type = $type; diff --git a/Tests/Converter/BowerPackageConverterTest.php b/Tests/Converter/BowerPackageConverterTest.php index 48cab2c5..24238d06 100644 --- a/Tests/Converter/BowerPackageConverterTest.php +++ b/Tests/Converter/BowerPackageConverterTest.php @@ -37,23 +37,23 @@ public function testConvert() { $composer = $this->converter->convert($this->asset); - $this->assertArrayHasKey('name', $composer); - $this->assertSame('ASSET/'.$this->asset['name'], $composer['name']); + static::assertArrayHasKey('name', $composer); + static::assertSame('ASSET/'.$this->asset['name'], $composer['name']); - $this->assertArrayHasKey('type', $composer); - $this->assertSame('ASSET_TYPE', $composer['type']); + static::assertArrayHasKey('type', $composer); + static::assertSame('ASSET_TYPE', $composer['type']); - $this->assertArrayHasKey('description', $composer); - $this->assertSame($this->asset['description'], $composer['description']); + static::assertArrayHasKey('description', $composer); + static::assertSame($this->asset['description'], $composer['description']); - $this->assertArrayHasKey('version', $composer); - $this->assertSame('1.0.0-pre', $composer['version']); + static::assertArrayHasKey('version', $composer); + static::assertSame('1.0.0-pre', $composer['version']); - $this->assertArrayHasKey('keywords', $composer); - $this->assertSame($this->asset['keywords'], $composer['keywords']); + static::assertArrayHasKey('keywords', $composer); + static::assertSame($this->asset['keywords'], $composer['keywords']); - $this->assertArrayHasKey('require', $composer); - $this->assertSame(array( + static::assertArrayHasKey('require', $composer); + static::assertSame(array( 'ASSET/library1' => '>= 1.0.0', 'ASSET/library2' => '>= 1.0.0', 'ASSET/library2-0.9.0' => '0.9.0', @@ -77,37 +77,37 @@ public function testConvert() 'ASSET/test-library20-file' => '*', ), $composer['require']); - $this->assertArrayNotHasKey('require-dev', $composer); + static::assertArrayNotHasKey('require-dev', $composer); - $this->assertArrayHasKey('license', $composer); - $this->assertSame($this->asset['license'], $composer['license']); + static::assertArrayHasKey('license', $composer); + static::assertSame($this->asset['license'], $composer['license']); - $this->assertArrayHasKey('bin', $composer); - $this->assertSame($this->asset['bin'], $composer['bin']); + static::assertArrayHasKey('bin', $composer); + static::assertSame($this->asset['bin'], $composer['bin']); - $this->assertArrayHasKey('extra', $composer); + static::assertArrayHasKey('extra', $composer); - $this->assertArrayHasKey('bower-asset-main', $composer['extra']); - $this->assertSame($this->asset['main'], $composer['extra']['bower-asset-main']); + static::assertArrayHasKey('bower-asset-main', $composer['extra']); + static::assertSame($this->asset['main'], $composer['extra']['bower-asset-main']); - $this->assertArrayHasKey('bower-asset-ignore', $composer['extra']); - $this->assertSame($this->asset['ignore'], $composer['extra']['bower-asset-ignore']); + static::assertArrayHasKey('bower-asset-ignore', $composer['extra']); + static::assertSame($this->asset['ignore'], $composer['extra']['bower-asset-ignore']); - $this->assertArrayHasKey('bower-asset-private', $composer['extra']); - $this->assertSame($this->asset['private'], $composer['extra']['bower-asset-private']); + static::assertArrayHasKey('bower-asset-private', $composer['extra']); + static::assertSame($this->asset['private'], $composer['extra']['bower-asset-private']); - $this->assertArrayNotHasKey('homepage', $composer); - $this->assertArrayNotHasKey('time', $composer); - $this->assertArrayNotHasKey('authors', $composer); - $this->assertArrayNotHasKey('support', $composer); - $this->assertArrayNotHasKey('conflict', $composer); - $this->assertArrayNotHasKey('replace', $composer); - $this->assertArrayNotHasKey('provide', $composer); - $this->assertArrayNotHasKey('suggest', $composer); - $this->assertArrayNotHasKey('autoload', $composer); - $this->assertArrayNotHasKey('autoload-dev', $composer); - $this->assertArrayNotHasKey('include-path', $composer); - $this->assertArrayNotHasKey('target-dir', $composer); - $this->assertArrayNotHasKey('archive', $composer); + static::assertArrayNotHasKey('homepage', $composer); + static::assertArrayNotHasKey('time', $composer); + static::assertArrayNotHasKey('authors', $composer); + static::assertArrayNotHasKey('support', $composer); + static::assertArrayNotHasKey('conflict', $composer); + static::assertArrayNotHasKey('replace', $composer); + static::assertArrayNotHasKey('provide', $composer); + static::assertArrayNotHasKey('suggest', $composer); + static::assertArrayNotHasKey('autoload', $composer); + static::assertArrayNotHasKey('autoload-dev', $composer); + static::assertArrayNotHasKey('include-path', $composer); + static::assertArrayNotHasKey('target-dir', $composer); + static::assertArrayNotHasKey('archive', $composer); } } diff --git a/Tests/Converter/NpmPackageConverterTest.php b/Tests/Converter/NpmPackageConverterTest.php index 307f9973..cac3f18b 100644 --- a/Tests/Converter/NpmPackageConverterTest.php +++ b/Tests/Converter/NpmPackageConverterTest.php @@ -38,32 +38,32 @@ public function testConvert() { $composer = $this->converter->convert($this->asset); - $this->assertArrayHasKey('name', $composer); - $this->assertSame('ASSET/'.$this->asset['name'], $composer['name']); + static::assertArrayHasKey('name', $composer); + static::assertSame('ASSET/'.$this->asset['name'], $composer['name']); - $this->assertArrayHasKey('type', $composer); - $this->assertSame('ASSET_TYPE', $composer['type']); + static::assertArrayHasKey('type', $composer); + static::assertSame('ASSET_TYPE', $composer['type']); - $this->assertArrayHasKey('description', $composer); - $this->assertSame($this->asset['description'], $composer['description']); + static::assertArrayHasKey('description', $composer); + static::assertSame($this->asset['description'], $composer['description']); - $this->assertArrayHasKey('version', $composer); - $this->assertSame('1.0.0-pre', $composer['version']); + static::assertArrayHasKey('version', $composer); + static::assertSame('1.0.0-pre', $composer['version']); - $this->assertArrayHasKey('keywords', $composer); - $this->assertSame($this->asset['keywords'], $composer['keywords']); + static::assertArrayHasKey('keywords', $composer); + static::assertSame($this->asset['keywords'], $composer['keywords']); - $this->assertArrayHasKey('homepage', $composer); - $this->assertSame($this->asset['homepage'], $composer['homepage']); + static::assertArrayHasKey('homepage', $composer); + static::assertSame($this->asset['homepage'], $composer['homepage']); - $this->assertArrayHasKey('license', $composer); - $this->assertSame($this->asset['license'], $composer['license']); + static::assertArrayHasKey('license', $composer); + static::assertSame($this->asset['license'], $composer['license']); - $this->assertArrayHasKey('authors', $composer); - $this->assertSame(array_merge(array($this->asset['author']), $this->asset['contributors']), $composer['authors']); + static::assertArrayHasKey('authors', $composer); + static::assertSame(array_merge(array($this->asset['author']), $this->asset['contributors']), $composer['authors']); - $this->assertArrayHasKey('require', $composer); - $this->assertSame(array( + static::assertArrayHasKey('require', $composer); + static::assertSame(array( 'ASSET/library1' => '>= 1.0.0', 'ASSET/library2' => '>= 1.0.0', 'ASSET/library2-0.9.0' => '0.9.0', @@ -88,76 +88,76 @@ public function testConvert() 'ASSET/library21' => '1 || 2', ), $composer['require']); - $this->assertArrayNotHasKey('require-dev', $composer); + static::assertArrayNotHasKey('require-dev', $composer); - $this->assertArrayHasKey('bin', $composer); - $this->assertInternalType('array', $composer['bin']); - $this->assertSame($this->asset['bin'], $composer['bin'][0]); + static::assertArrayHasKey('bin', $composer); + static::assertInternalType('array', $composer['bin']); + static::assertSame($this->asset['bin'], $composer['bin'][0]); - $this->assertArrayHasKey('extra', $composer); + static::assertArrayHasKey('extra', $composer); - $this->assertArrayHasKey('npm-asset-bugs', $composer['extra']); - $this->assertSame($this->asset['bugs'], $composer['extra']['npm-asset-bugs']); + static::assertArrayHasKey('npm-asset-bugs', $composer['extra']); + static::assertSame($this->asset['bugs'], $composer['extra']['npm-asset-bugs']); - $this->assertArrayHasKey('npm-asset-files', $composer['extra']); - $this->assertSame($this->asset['files'], $composer['extra']['npm-asset-files']); + static::assertArrayHasKey('npm-asset-files', $composer['extra']); + static::assertSame($this->asset['files'], $composer['extra']['npm-asset-files']); - $this->assertArrayHasKey('npm-asset-main', $composer['extra']); - $this->assertSame($this->asset['main'], $composer['extra']['npm-asset-main']); + static::assertArrayHasKey('npm-asset-main', $composer['extra']); + static::assertSame($this->asset['main'], $composer['extra']['npm-asset-main']); - $this->assertArrayHasKey('npm-asset-man', $composer['extra']); - $this->assertSame($this->asset['man'], $composer['extra']['npm-asset-man']); + static::assertArrayHasKey('npm-asset-man', $composer['extra']); + static::assertSame($this->asset['man'], $composer['extra']['npm-asset-man']); - $this->assertArrayHasKey('npm-asset-directories', $composer['extra']); - $this->assertSame($this->asset['directories'], $composer['extra']['npm-asset-directories']); + static::assertArrayHasKey('npm-asset-directories', $composer['extra']); + static::assertSame($this->asset['directories'], $composer['extra']['npm-asset-directories']); - $this->assertArrayHasKey('npm-asset-repository', $composer['extra']); - $this->assertSame($this->asset['repository'], $composer['extra']['npm-asset-repository']); + static::assertArrayHasKey('npm-asset-repository', $composer['extra']); + static::assertSame($this->asset['repository'], $composer['extra']['npm-asset-repository']); - $this->assertArrayHasKey('npm-asset-scripts', $composer['extra']); - $this->assertSame($this->asset['scripts'], $composer['extra']['npm-asset-scripts']); + static::assertArrayHasKey('npm-asset-scripts', $composer['extra']); + static::assertSame($this->asset['scripts'], $composer['extra']['npm-asset-scripts']); - $this->assertArrayHasKey('npm-asset-config', $composer['extra']); - $this->assertSame($this->asset['config'], $composer['extra']['npm-asset-config']); + static::assertArrayHasKey('npm-asset-config', $composer['extra']); + static::assertSame($this->asset['config'], $composer['extra']['npm-asset-config']); - $this->assertArrayHasKey('npm-asset-bundled-dependencies', $composer['extra']); - $this->assertSame($this->asset['bundledDependencies'], $composer['extra']['npm-asset-bundled-dependencies']); + static::assertArrayHasKey('npm-asset-bundled-dependencies', $composer['extra']); + static::assertSame($this->asset['bundledDependencies'], $composer['extra']['npm-asset-bundled-dependencies']); - $this->assertArrayHasKey('npm-asset-optional-dependencies', $composer['extra']); - $this->assertSame($this->asset['optionalDependencies'], $composer['extra']['npm-asset-optional-dependencies']); + static::assertArrayHasKey('npm-asset-optional-dependencies', $composer['extra']); + static::assertSame($this->asset['optionalDependencies'], $composer['extra']['npm-asset-optional-dependencies']); - $this->assertArrayHasKey('npm-asset-engines', $composer['extra']); - $this->assertSame($this->asset['engines'], $composer['extra']['npm-asset-engines']); + static::assertArrayHasKey('npm-asset-engines', $composer['extra']); + static::assertSame($this->asset['engines'], $composer['extra']['npm-asset-engines']); - $this->assertArrayHasKey('npm-asset-engine-strict', $composer['extra']); - $this->assertSame($this->asset['engineStrict'], $composer['extra']['npm-asset-engine-strict']); + static::assertArrayHasKey('npm-asset-engine-strict', $composer['extra']); + static::assertSame($this->asset['engineStrict'], $composer['extra']['npm-asset-engine-strict']); - $this->assertArrayHasKey('npm-asset-os', $composer['extra']); - $this->assertSame($this->asset['os'], $composer['extra']['npm-asset-os']); + static::assertArrayHasKey('npm-asset-os', $composer['extra']); + static::assertSame($this->asset['os'], $composer['extra']['npm-asset-os']); - $this->assertArrayHasKey('npm-asset-cpu', $composer['extra']); - $this->assertSame($this->asset['cpu'], $composer['extra']['npm-asset-cpu']); + static::assertArrayHasKey('npm-asset-cpu', $composer['extra']); + static::assertSame($this->asset['cpu'], $composer['extra']['npm-asset-cpu']); - $this->assertArrayHasKey('npm-asset-prefer-global', $composer['extra']); - $this->assertSame($this->asset['preferGlobal'], $composer['extra']['npm-asset-prefer-global']); + static::assertArrayHasKey('npm-asset-prefer-global', $composer['extra']); + static::assertSame($this->asset['preferGlobal'], $composer['extra']['npm-asset-prefer-global']); - $this->assertArrayHasKey('npm-asset-private', $composer['extra']); - $this->assertSame($this->asset['private'], $composer['extra']['npm-asset-private']); + static::assertArrayHasKey('npm-asset-private', $composer['extra']); + static::assertSame($this->asset['private'], $composer['extra']['npm-asset-private']); - $this->assertArrayHasKey('npm-asset-publish-config', $composer['extra']); - $this->assertSame($this->asset['publishConfig'], $composer['extra']['npm-asset-publish-config']); + static::assertArrayHasKey('npm-asset-publish-config', $composer['extra']); + static::assertSame($this->asset['publishConfig'], $composer['extra']['npm-asset-publish-config']); - $this->assertArrayNotHasKey('time', $composer); - $this->assertArrayNotHasKey('support', $composer); - $this->assertArrayNotHasKey('conflict', $composer); - $this->assertArrayNotHasKey('replace', $composer); - $this->assertArrayNotHasKey('provide', $composer); - $this->assertArrayNotHasKey('suggest', $composer); - $this->assertArrayNotHasKey('autoload', $composer); - $this->assertArrayNotHasKey('autoload-dev', $composer); - $this->assertArrayNotHasKey('include-path', $composer); - $this->assertArrayNotHasKey('target-dir', $composer); - $this->assertArrayNotHasKey('archive', $composer); + static::assertArrayNotHasKey('time', $composer); + static::assertArrayNotHasKey('support', $composer); + static::assertArrayNotHasKey('conflict', $composer); + static::assertArrayNotHasKey('replace', $composer); + static::assertArrayNotHasKey('provide', $composer); + static::assertArrayNotHasKey('suggest', $composer); + static::assertArrayNotHasKey('autoload', $composer); + static::assertArrayNotHasKey('autoload-dev', $composer); + static::assertArrayNotHasKey('include-path', $composer); + static::assertArrayNotHasKey('target-dir', $composer); + static::assertArrayNotHasKey('archive', $composer); } public function testConvertWithScope() @@ -165,16 +165,16 @@ public function testConvertWithScope() $this->asset = $this->loadPackage('npm-scope.json'); $composer = $this->converter->convert($this->asset); - $this->assertArrayHasKey('name', $composer); - $this->assertSame('ASSET/scope--test', $composer['name']); + static::assertArrayHasKey('name', $composer); + static::assertSame('ASSET/scope--test', $composer['name']); - $this->assertArrayHasKey('require', $composer); - $this->assertSame(array( + static::assertArrayHasKey('require', $composer); + static::assertSame(array( 'ASSET/scope--library1' => '>= 1.0.0', 'ASSET/scope2--library2' => '>= 1.0.0', ), $composer['require']); - $this->assertArrayNotHasKey('require-dev', $composer); + static::assertArrayNotHasKey('require-dev', $composer); } public function getConvertDistData() @@ -199,7 +199,7 @@ public function getConvertDistData() */ public function testConvertDist($value, $result) { - $this->assertSame($result, NpmPackageUtil::convertDist($value)); + static::assertSame($result, NpmPackageUtil::convertDist($value)); } /** diff --git a/Tests/Converter/NpmPackageUtilTest.php b/Tests/Converter/NpmPackageUtilTest.php index 6e170e8b..d7fe3b59 100644 --- a/Tests/Converter/NpmPackageUtilTest.php +++ b/Tests/Converter/NpmPackageUtilTest.php @@ -27,7 +27,7 @@ public function testConvertName() $packageName = '@vendor/package'; $expected = 'vendor--package'; - $this->assertSame($expected, NpmPackageUtil::convertName($packageName)); + static::assertSame($expected, NpmPackageUtil::convertName($packageName)); } public function testRevertName() @@ -35,7 +35,7 @@ public function testRevertName() $packageName = 'vendor--package'; $expected = '@vendor/package'; - $this->assertSame($expected, NpmPackageUtil::revertName($packageName)); + static::assertSame($expected, NpmPackageUtil::revertName($packageName)); } public function getLicenses() @@ -55,6 +55,6 @@ public function getLicenses() */ public function testLicenses($licenses, $expected) { - $this->assertSame($expected, NpmPackageUtil::convertLicenses($licenses)); + static::assertSame($expected, NpmPackageUtil::convertLicenses($licenses)); } } diff --git a/Tests/Converter/SemverConverterTest.php b/Tests/Converter/SemverConverterTest.php index 91018120..537503c6 100644 --- a/Tests/Converter/SemverConverterTest.php +++ b/Tests/Converter/SemverConverterTest.php @@ -46,10 +46,10 @@ protected function tearDown() */ public function testConverter($semver, $composer) { - $this->assertEquals($composer, $this->converter->convertVersion($semver)); + static::assertEquals($composer, $this->converter->convertVersion($semver)); if (!ctype_alpha($semver) && !\in_array($semver, array(null, ''), true)) { - $this->assertEquals('v'.$composer, $this->converter->convertVersion('v'.$semver)); + static::assertEquals('v'.$composer, $this->converter->convertVersion('v'.$semver)); } } @@ -112,7 +112,7 @@ public function getTestVersions() */ public function testRangeConverter($semver, $composer) { - $this->assertEquals($composer, $this->converter->convertRange($semver)); + static::assertEquals($composer, $this->converter->convertRange($semver)); } public function getTestRanges() diff --git a/Tests/FxpAssetPluginTest.php b/Tests/FxpAssetPluginTest.php index 95c8bc82..95844d91 100644 --- a/Tests/FxpAssetPluginTest.php +++ b/Tests/FxpAssetPluginTest.php @@ -55,9 +55,9 @@ protected function setUp() { $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $config = $this->getMockBuilder('Composer\Config')->getMock(); - $config->expects($this->any()) + $config->expects(static::any()) ->method('get') - ->will($this->returnCallback(function ($key) { + ->willReturnCallback(function ($key) { $value = null; switch ($key) { @@ -68,16 +68,16 @@ protected function setUp() } return $value; - })) + }) ; $this->package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock(); - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getRequires') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getDevRequires') - ->will($this->returnValue(array())) + ->willReturn(array()) ; /** @var IOInterface $io */ @@ -86,21 +86,21 @@ protected function setUp() $im = new InstallationManager(); $composer = $this->getMockBuilder('Composer\Composer')->getMock(); - $composer->expects($this->any()) + $composer->expects(static::any()) ->method('getRepositoryManager') - ->will($this->returnValue($rm)) + ->willReturn($rm) ; - $composer->expects($this->any()) + $composer->expects(static::any()) ->method('getPackage') - ->will($this->returnValue($this->package)) + ->willReturn($this->package) ; - $composer->expects($this->any()) + $composer->expects(static::any()) ->method('getConfig') - ->will($this->returnValue($config)) + ->willReturn($config) ; - $composer->expects($this->any()) + $composer->expects(static::any()) ->method('getInstallationManager') - ->will($this->returnValue($im)) + ->willReturn($im) ; $this->plugin = new FxpAssetPlugin(); @@ -120,23 +120,23 @@ protected function tearDown() public function testAssetRepositories() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getConfig') - ->will($this->returnValue(array( + ->willReturn(array( 'fxp-asset' => array( 'private-bower-registries' => array( 'my-private-bower-server' => 'https://my-private-bower-server.tld/packages', ), ), - ))) + )) ; $this->plugin->activate($this->composer, $this->io); $repos = $this->composer->getRepositoryManager()->getRepositories(); - $this->assertCount(3, $repos); + static::assertCount(3, $repos); foreach ($repos as $repo) { - $this->assertInstanceOf('Composer\Repository\ComposerRepository', $repo); + static::assertInstanceOf('Composer\Repository\ComposerRepository', $repo); } } @@ -147,9 +147,9 @@ public function testAssetRepositories() */ public function testAssetVcsRepositories($type) { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array())) + ->willReturn(array()) ; $this->plugin->activate($this->composer, $this->io); @@ -160,7 +160,7 @@ public function testAssetVcsRepositories($type) 'name' => 'foo', )); - $this->assertInstanceOf('Composer\Repository\VcsRepository', $repo); + static::assertInstanceOf('Composer\Repository\VcsRepository', $repo); } public function getDataForAssetVcsRepositories() @@ -181,11 +181,11 @@ public function getDataForAssetVcsRepositories() */ public function testAssetRepositoryWithValueIsNotArray() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array('asset-repositories' => array( + ->willReturn(array('asset-repositories' => array( 'invalid_repo', - )))) + ))) ; $this->plugin->activate($this->composer, $this->io); @@ -196,11 +196,11 @@ public function testAssetRepositoryWithValueIsNotArray() */ public function testAssetRepositoryWithInvalidType() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array('asset-repositories' => array( + ->willReturn(array('asset-repositories' => array( array(), - )))) + ))) ; $this->plugin->activate($this->composer, $this->io); @@ -211,11 +211,11 @@ public function testAssetRepositoryWithInvalidType() */ public function testAssetRepositoryWithInvalidTypeFormat() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array('asset-repositories' => array( + ->willReturn(array('asset-repositories' => array( array('type' => 'invalid_type'), - )))) + ))) ; $this->plugin->activate($this->composer, $this->io); @@ -226,11 +226,11 @@ public function testAssetRepositoryWithInvalidTypeFormat() */ public function testAssetRepositoryWithInvalidUrl() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array('asset-repositories' => array( + ->willReturn(array('asset-repositories' => array( array('type' => 'npm-vcs'), - )))) + ))) ; $this->plugin->activate($this->composer, $this->io); @@ -238,35 +238,35 @@ public function testAssetRepositoryWithInvalidUrl() public function testAssetRepository() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array('asset-repositories' => array( + ->willReturn(array('asset-repositories' => array( array('type' => 'npm-vcs', 'url' => 'http://foo.tld', 'name' => 'foo'), - )))) + ))) ; $this->plugin->activate($this->composer, $this->io); $repos = $this->composer->getRepositoryManager()->getRepositories(); - $this->assertCount(3, $repos); - $this->assertInstanceOf('Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository', $repos[2]); + static::assertCount(3, $repos); + static::assertInstanceOf('Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository', $repos[2]); } public function testAssetRepositoryWithAlreadyExistRepositoryName() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array('asset-repositories' => array( + ->willReturn(array('asset-repositories' => array( array('type' => 'npm-vcs', 'url' => 'http://foo.tld', 'name' => 'foo'), array('type' => 'npm-vcs', 'url' => 'http://foo.tld', 'name' => 'foo'), - )))) + ))) ; $this->plugin->activate($this->composer, $this->io); $repos = $this->composer->getRepositoryManager()->getRepositories(); - $this->assertCount(3, $repos); - $this->assertInstanceOf('Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository', $repos[2]); + static::assertCount(3, $repos); + static::assertInstanceOf('Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository', $repos[2]); } /** @@ -274,11 +274,11 @@ public function testAssetRepositoryWithAlreadyExistRepositoryName() */ public function testAssetPackageWithoutPackage() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array('asset-repositories' => array( + ->willReturn(array('asset-repositories' => array( array('type' => 'package'), - )))) + ))) ; $this->plugin->activate($this->composer, $this->io); @@ -289,11 +289,11 @@ public function testAssetPackageWithoutPackage() */ public function testAssetPackageWithInvalidPackage() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array('asset-repositories' => array( + ->willReturn(array('asset-repositories' => array( array('type' => 'package', 'package' => array('key' => 'value')), - )))) + ))) ; $this->plugin->activate($this->composer, $this->io); @@ -301,9 +301,9 @@ public function testAssetPackageWithInvalidPackage() public function testAssetPackageRepositories() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array('asset-repositories' => array( + ->willReturn(array('asset-repositories' => array( array( 'type' => 'package', 'package' => array( @@ -316,7 +316,7 @@ public function testAssetPackageRepositories() ), ), ), - )))) + ))) ; $rm = $this->composer->getRepositoryManager(); @@ -324,59 +324,59 @@ public function testAssetPackageRepositories() $this->plugin->activate($this->composer, $this->io); $repos = $this->composer->getRepositoryManager()->getRepositories(); - $this->assertCount(3, $repos); - $this->assertInstanceOf('Composer\Repository\PackageRepository', $repos[2]); + static::assertCount(3, $repos); + static::assertInstanceOf('Composer\Repository\PackageRepository', $repos[2]); } public function testOptionsForAssetRegistryRepositories() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getConfig') - ->will($this->returnValue(array( + ->willReturn(array( 'fxp-asset' => array( 'registry-options' => array( 'npm-option1' => 'value 1', 'bower-option1' => 'value 2', ), ), - ))) + )) ; - $this->assertInstanceOf('Composer\Package\RootPackageInterface', $this->package); + static::assertInstanceOf('Composer\Package\RootPackageInterface', $this->package); $this->plugin->activate($this->composer, $this->io); } public function testSubscribeEvents() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $this->assertCount(2, $this->plugin->getSubscribedEvents()); - $this->assertCount(0, $this->composer->getRepositoryManager()->getRepositories()); + static::assertCount(2, $this->plugin->getSubscribedEvents()); + static::assertCount(0, $this->composer->getRepositoryManager()->getRepositories()); /** @var InstallerEvent|\PHPUnit_Framework_MockObject_MockObject $eventInstaller */ $eventInstaller = $this->getMockBuilder('Composer\Installer\InstallerEvent') ->disableOriginalConstructor() ->getMock() ; - $eventInstaller->expects($this->any()) + $eventInstaller->expects(static::any()) ->method('getPool') - ->will($this->returnValue( + ->willReturn( $this->getMockBuilder(Pool::class) ->disableOriginalConstructor() ->getMock() - )) + ) ; /** @var CommandEvent|\PHPUnit_Framework_MockObject_MockObject $eventCommand */ $eventCommand = $this->getMockBuilder('Composer\Plugin\CommandEvent') ->disableOriginalConstructor() ->getMock() ; - $eventCommand->expects($this->any()) + $eventCommand->expects(static::any()) ->method('getCommandName') - ->will($this->returnValue('show')) + ->willReturn('show') ; $this->plugin->activate($this->composer, $this->io); @@ -386,16 +386,16 @@ public function testSubscribeEvents() public function testAssetInstallers() { - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array())) + ->willReturn(array()) ; $this->plugin->activate($this->composer, $this->io); $im = $this->composer->getInstallationManager(); - $this->assertInstanceOf('Fxp\Composer\AssetPlugin\Installer\BowerInstaller', $im->getInstaller('bower-asset-library')); - $this->assertInstanceOf('Fxp\Composer\AssetPlugin\Installer\AssetInstaller', $im->getInstaller('npm-asset-library')); + static::assertInstanceOf('Fxp\Composer\AssetPlugin\Installer\BowerInstaller', $im->getInstaller('bower-asset-library')); + static::assertInstanceOf('Fxp\Composer\AssetPlugin\Installer\AssetInstaller', $im->getInstaller('npm-asset-library')); } public function testGetConfig() @@ -403,6 +403,6 @@ public function testGetConfig() $this->plugin->activate($this->composer, $this->io); $config = $this->plugin->getConfig(); - $this->assertInstanceOf(\Fxp\Composer\AssetPlugin\Config\Config::class, $config); + static::assertInstanceOf(\Fxp\Composer\AssetPlugin\Config\Config::class, $config); } } diff --git a/Tests/Installer/AssetInstallerTest.php b/Tests/Installer/AssetInstallerTest.php index a24d64c7..529a8504 100644 --- a/Tests/Installer/AssetInstallerTest.php +++ b/Tests/Installer/AssetInstallerTest.php @@ -55,9 +55,9 @@ protected function setUp() { $this->io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $config = $this->getMockBuilder('Composer\Config')->getMock(); - $config->expects($this->any()) + $config->expects(static::any()) ->method('get') - ->will($this->returnCallback(function ($key) { + ->willReturnCallback(function ($key) { $value = null; switch ($key) { @@ -72,45 +72,45 @@ protected function setUp() } return $value; - })) + }) ; $this->package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock(); $this->composer = $this->getMockBuilder('Composer\Composer')->getMock(); - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getPackage') - ->will($this->returnValue($this->package)) + ->willReturn($this->package) ; - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getConfig') - ->will($this->returnValue($config)) + ->willReturn($config) ; $this->type = $this->getMockBuilder('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface')->getMock(); - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getName') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getComposerVendorName') - ->will($this->returnValue('foo-asset')) + ->willReturn('foo-asset') ; - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getComposerType') - ->will($this->returnValue('foo-asset-library')) + ->willReturn('foo-asset-library') ; - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getFilename') - ->will($this->returnValue('foo.json')) + ->willReturn('foo.json') ; - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getVersionConverter') - ->will($this->returnValue($this->getMockBuilder('Fxp\Composer\AssetPlugin\Converter\VersionConverterInterface')->getMock())) + ->willReturn($this->getMockBuilder('Fxp\Composer\AssetPlugin\Converter\VersionConverterInterface')->getMock()) ; - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getPackageConverter') - ->will($this->returnValue($this->getMockBuilder('Fxp\Composer\AssetPlugin\Converter\PackageConverterInterface')->getMock())) + ->willReturn($this->getMockBuilder('Fxp\Composer\AssetPlugin\Converter\PackageConverterInterface')->getMock()) ; } @@ -133,11 +133,11 @@ public function testDefaultVendorDir() $installerPath = $installer->getInstallPath($this->createPackageMock('foo-asset/foo')); $installerPath = str_replace('\\', '/', $installerPath); - $this->assertEquals($vendorDir.'/foo', $installerPath); + static::assertEquals($vendorDir.'/foo', $installerPath); $installerPath2 = $installer->getInstallPath($this->createPackageMock('foo-asset/foo/bar')); $installerPath2 = str_replace('\\', '/', $installerPath2); - $this->assertEquals($vendorDir.'/foo/bar', $installerPath2); + static::assertEquals($vendorDir.'/foo/bar', $installerPath2); } public function testCustomFooDir() @@ -146,24 +146,24 @@ public function testCustomFooDir() $vendorDir = str_replace('\\', '/', $vendorDir); $package = $this->package; - $package->expects($this->any()) + $package->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array( + ->willReturn(array( 'asset-installer-paths' => array( $this->type->getComposerType() => $vendorDir, ), - ))) + )) ; $installer = $this->createInstaller(); $installerPath = $installer->getInstallPath($this->createPackageMock('foo-asset/foo')); $installerPath = str_replace('\\', '/', $installerPath); - $this->assertEquals($vendorDir.'/foo', $installerPath); + static::assertEquals($vendorDir.'/foo', $installerPath); $installerPath2 = $installer->getInstallPath($this->createPackageMock('foo-asset/foo/bar')); $installerPath2 = str_replace('\\', '/', $installerPath2); - $this->assertEquals($vendorDir.'/foo/bar', $installerPath2); + static::assertEquals($vendorDir.'/foo/bar', $installerPath2); } public function testInstall() @@ -183,9 +183,9 @@ public function testInstall() ->getMock() ; - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getDownloadManager') - ->will($this->returnValue($dm)) + ->willReturn($dm) ; /** @var \PHPUnit_Framework_MockObject_MockObject $package */ @@ -194,13 +194,13 @@ public function testInstall() /** @var PackageInterface $package */ $packageDir = $vendorDir.'/'.$package->getPrettyName(); - $dm->expects($this->once()) + $dm->expects(static::once()) ->method('download') ->with($package, $vendorDir.\DIRECTORY_SEPARATOR.'foo-asset/package') ; $repository = $this->getMockBuilder('Composer\Repository\InstalledRepositoryInterface')->getMock(); - $repository->expects($this->once()) + $repository->expects(static::once()) ->method('addPackage') ->with($package) ; @@ -210,7 +210,7 @@ public function testInstall() /* @var InstalledRepositoryInterface $repository */ $library->install($repository, $package); - $this->assertFileExists($vendorDir, 'Vendor dir should be created'); + static::assertFileExists($vendorDir, 'Vendor dir should be created'); $this->ensureDirectoryExistsAndClear($packageDir); } @@ -242,9 +242,9 @@ protected function createRootPackageMock() ->getMock() ; - $package->expects($this->any()) + $package->expects(static::any()) ->method('getConfig') - ->will($this->returnValue(array())) + ->willReturn(array()) ; return $package; diff --git a/Tests/Installer/BowerInstallerTest.php b/Tests/Installer/BowerInstallerTest.php index 58658bf1..6ed0afcc 100644 --- a/Tests/Installer/BowerInstallerTest.php +++ b/Tests/Installer/BowerInstallerTest.php @@ -113,29 +113,29 @@ protected function setUp() $this->io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $this->type = $this->getMockBuilder('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface')->getMock(); - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getName') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getComposerVendorName') - ->will($this->returnValue('foo-asset')) + ->willReturn('foo-asset') ; - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getComposerType') - ->will($this->returnValue('foo-asset-library')) + ->willReturn('foo-asset-library') ; - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getFilename') - ->will($this->returnValue('foo.json')) + ->willReturn('foo.json') ; - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getVersionConverter') - ->will($this->returnValue($this->getMockBuilder('Fxp\Composer\AssetPlugin\Converter\VersionConverterInterface')->getMock())) + ->willReturn($this->getMockBuilder('Fxp\Composer\AssetPlugin\Converter\VersionConverterInterface')->getMock()) ; - $this->type->expects($this->any()) + $this->type->expects(static::any()) ->method('getPackageConverter') - ->will($this->returnValue($this->getMockBuilder('Fxp\Composer\AssetPlugin\Converter\PackageConverterInterface')->getMock())) + ->willReturn($this->getMockBuilder('Fxp\Composer\AssetPlugin\Converter\PackageConverterInterface')->getMock()) ; } @@ -158,7 +158,7 @@ public function testInstallerCreationShouldNotCreateVendorDirectory() $this->composer->setPackage($rootPackage); new BowerInstaller(ConfigBuilder::build($this->composer), $io, $this->composer, $type); - $this->assertFileNotExists($this->vendorDir); + static::assertFileNotExists($this->vendorDir); } public function testInstallerCreationShouldNotCreateBinDirectory() @@ -174,7 +174,7 @@ public function testInstallerCreationShouldNotCreateBinDirectory() $this->composer->setPackage($rootPackage); new BowerInstaller(ConfigBuilder::build($this->composer), $io, $this->composer, $type); - $this->assertFileNotExists($this->binDir); + static::assertFileNotExists($this->binDir); } public function testIsInstalled() @@ -192,9 +192,9 @@ public function testIsInstalled() /** @var \PHPUnit_Framework_MockObject_MockObject $package */ $package = $this->createPackageMock(); $package - ->expects($this->any()) + ->expects(static::any()) ->method('getPrettyName') - ->will($this->returnValue('foo-asset/package')) + ->willReturn('foo-asset/package') ; /** @var PackageInterface $package */ @@ -204,15 +204,15 @@ public function testIsInstalled() /** @var \PHPUnit_Framework_MockObject_MockObject $repository */ $repository = $this->repository; $repository - ->expects($this->exactly(2)) + ->expects(static::exactly(2)) ->method('hasPackage') ->with($package) - ->will($this->onConsecutiveCalls(true, false)) + ->will(static::onConsecutiveCalls(true, false)) ; - /* @var InstalledRepositoryInterface $repository */ - $this->assertTrue($library->isInstalled($repository, $package)); - $this->assertFalse($library->isInstalled($repository, $package)); + /** @var InstalledRepositoryInterface $repository */ + static::assertTrue($library->isInstalled($repository, $package)); + static::assertFalse($library->isInstalled($repository, $package)); $this->ensureDirectoryExistsAndClear($packageDir); } @@ -262,9 +262,9 @@ public function testInstall(array $ignoreFiles) /** @var \PHPUnit_Framework_MockObject_MockObject $package */ $package = $this->createPackageMock($ignoreFiles); $package - ->expects($this->any()) + ->expects(static::any()) ->method('getPrettyName') - ->will($this->returnValue('foo-asset/package')) + ->willReturn('foo-asset/package') ; /** @var PackageInterface $package */ @@ -274,7 +274,7 @@ public function testInstall(array $ignoreFiles) /** @var \PHPUnit_Framework_MockObject_MockObject $dm */ $dm = $this->dm; $dm - ->expects($this->once()) + ->expects(static::once()) ->method('download') ->with($package, $this->vendorDir.\DIRECTORY_SEPARATOR.'foo-asset/package') ; @@ -282,15 +282,15 @@ public function testInstall(array $ignoreFiles) /** @var \PHPUnit_Framework_MockObject_MockObject $repository */ $repository = $this->repository; $repository - ->expects($this->once()) + ->expects(static::once()) ->method('addPackage') ->with($package) ; /* @var InstalledRepositoryInterface $repository */ $library->install($repository, $package); - $this->assertFileExists($this->vendorDir, 'Vendor dir should be created'); - $this->assertFileExists($this->binDir, 'Bin dir should be created'); + static::assertFileExists($this->vendorDir, 'Vendor dir should be created'); + static::assertFileExists($this->binDir, 'Bin dir should be created'); $this->ensureDirectoryExistsAndClear($packageDir); } @@ -315,9 +315,9 @@ public function testUpdate(array $ignoreFiles) /** @var \PHPUnit_Framework_MockObject_MockObject $package */ $package = $this->createPackageMock($ignoreFiles); $package - ->expects($this->any()) + ->expects(static::any()) ->method('getPrettyName') - ->will($this->returnValue('foo-asset/package')) + ->willReturn('foo-asset/package') ; /** @var PackageInterface $package */ @@ -328,16 +328,16 @@ public function testUpdate(array $ignoreFiles) $repository = $this->repository; $repository - ->expects($this->exactly(2)) + ->expects(static::exactly(2)) ->method('hasPackage') ->with($package) - ->will($this->returnValue(true)) + ->willReturn(true) ; /* @var InstalledRepositoryInterface $repository */ $library->update($repository, $package, $package); - $this->assertFileExists($this->vendorDir, 'Vendor dir should be created'); - $this->assertFileExists($this->binDir, 'Bin dir should be created'); + static::assertFileExists($this->vendorDir, 'Vendor dir should be created'); + static::assertFileExists($this->binDir, 'Bin dir should be created'); $this->ensureDirectoryExistsAndClear($packageDir); } @@ -361,22 +361,22 @@ public function testUninstall() /* @var \PHPUnit_Framework_MockObject_MockObject $package */ $package - ->expects($this->any()) + ->expects(static::any()) ->method('getPrettyName') - ->will($this->returnValue('foo-asset/pkg')) + ->willReturn('foo-asset/pkg') ; /** @var \PHPUnit_Framework_MockObject_MockObject $repository */ $repository = $this->repository; $repository - ->expects($this->exactly(2)) + ->expects(static::exactly(2)) ->method('hasPackage') ->with($package) - ->will($this->onConsecutiveCalls(true, false)) + ->will(static::onConsecutiveCalls(true, false)) ; $repository - ->expects($this->once()) + ->expects(static::once()) ->method('removePackage') ->with($package) ; @@ -384,7 +384,7 @@ public function testUninstall() /** @var \PHPUnit_Framework_MockObject_MockObject $dm */ $dm = $this->dm; $dm - ->expects($this->once()) + ->expects(static::once()) ->method('remove') ->with($package, $this->vendorDir.\DIRECTORY_SEPARATOR.'foo-asset/pkg') ; @@ -412,19 +412,19 @@ public function testGetInstallPath() /* @var \PHPUnit_Framework_MockObject_MockObject $package */ $package - ->expects($this->once()) + ->expects(static::once()) ->method('getTargetDir') - ->will($this->returnValue(null)) + ->willReturn(null) ; $package - ->expects($this->any()) + ->expects(static::any()) ->method('getName') - ->will($this->returnValue('foo-asset/bar')) + ->willReturn('foo-asset/bar') ; $package - ->expects($this->any()) + ->expects(static::any()) ->method('getPrettyName') - ->will($this->returnValue('foo-asset/bar')) + ->willReturn('foo-asset/bar') ; /** @var PackageInterface $package */ @@ -433,7 +433,7 @@ public function testGetInstallPath() $packageDir = $library->getInstallPath($package); $packageDir = str_replace('\\', '/', $packageDir); - $this->assertEquals($exceptDir, $packageDir); + static::assertEquals($exceptDir, $packageDir); } public function testGetInstallPathWithTargetDir() @@ -452,14 +452,14 @@ public function testGetInstallPathWithTargetDir() /* @var \PHPUnit_Framework_MockObject_MockObject $package */ $package - ->expects($this->once()) + ->expects(static::once()) ->method('getTargetDir') - ->will($this->returnValue('Some/Namespace')) + ->willReturn('Some/Namespace') ; $package - ->expects($this->any()) + ->expects(static::any()) ->method('getPrettyName') - ->will($this->returnValue('foo-asset/bar')) + ->willReturn('foo-asset/bar') ; /** @var PackageInterface $package */ @@ -468,7 +468,7 @@ public function testGetInstallPathWithTargetDir() $packageDir = $library->getInstallPath($package); $packageDir = str_replace('\\', '/', $packageDir); - $this->assertEquals($exceptDir, $packageDir); + static::assertEquals($exceptDir, $packageDir); } /** @@ -488,9 +488,9 @@ public function testMainFiles(array $mainFiles) $extra = $package->getExtra(); if (isset($mainFiles['fxp-asset']['main-files'])) { - $this->assertEquals($extra['bower-asset-main'], $mainFiles['fxp-asset']['main-files']['foo-asset/bar']); + static::assertEquals($extra['bower-asset-main'], $mainFiles['fxp-asset']['main-files']['foo-asset/bar']); } else { - $this->assertEquals($extra, array()); + static::assertEquals($extra, array()); } } @@ -507,11 +507,11 @@ protected function createPackageMock(array $ignoreFiles = array()) ; $package - ->expects($this->any()) + ->expects(static::any()) ->method('getExtra') - ->will($this->returnValue(array( + ->willReturn(array( 'bower-asset-ignore' => $ignoreFiles, - ))) + )) ; return $package; @@ -529,9 +529,9 @@ protected function createRootPackageMock(array $mainFiles = array()) ; $package - ->expects($this->any()) + ->expects(static::any()) ->method('getConfig') - ->will($this->returnValue($mainFiles)) + ->willReturn($mainFiles) ; return $package; diff --git a/Tests/Installer/IgnoreFactoryTest.php b/Tests/Installer/IgnoreFactoryTest.php index dcb722e7..0a7fb59e 100644 --- a/Tests/Installer/IgnoreFactoryTest.php +++ b/Tests/Installer/IgnoreFactoryTest.php @@ -51,9 +51,9 @@ final class IgnoreFactoryTest extends \PHPUnit\Framework\TestCase protected function setUp() { $this->config = $this->getMockBuilder('Composer\Config')->getMock(); - $this->config->expects($this->any()) + $this->config->expects(static::any()) ->method('get') - ->will($this->returnCallback(function ($key) { + ->willReturnCallback(function ($key) { $value = null; switch ($key) { @@ -68,24 +68,24 @@ protected function setUp() } return $value; - })) + }) ; $this->rootPackage = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock(); $this->package = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getName') - ->will($this->returnValue('foo-asset/foo')) + ->willReturn('foo-asset/foo') ; $this->composer = $this->getMockBuilder('Composer\Composer')->getMock(); - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getPackage') - ->will($this->returnValue($this->rootPackage)) + ->willReturn($this->rootPackage) ; - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getConfig') - ->will($this->returnValue($this->config)) + ->willReturn($this->config) ; } @@ -102,8 +102,8 @@ public function testCreateWithoutIgnoreFiles() $config = ConfigBuilder::build($this->composer); $manager = IgnoreFactory::create($config, $this->composer, $this->package); - $this->assertTrue($manager->isEnabled()); - $this->assertFalse($manager->hasPattern()); + static::assertTrue($manager->isEnabled()); + static::assertFalse($manager->hasPattern()); $this->validateInstallDir($manager, $this->config->get('vendor-dir').'/'.$this->package->getName()); } @@ -120,16 +120,16 @@ public function testCreateWithIgnoreFiles() ), ); - $this->rootPackage->expects($this->any()) + $this->rootPackage->expects(static::any()) ->method('getConfig') - ->will($this->returnValue($config)) + ->willReturn($config) ; $config = ConfigBuilder::build($this->composer); $manager = IgnoreFactory::create($config, $this->composer, $this->package); - $this->assertTrue($manager->isEnabled()); - $this->assertTrue($manager->hasPattern()); + static::assertTrue($manager->isEnabled()); + static::assertTrue($manager->hasPattern()); $this->validateInstallDir($manager, $this->config->get('vendor-dir').'/'.$this->package->getName()); } @@ -139,8 +139,8 @@ public function testCreateWithCustomInstallDir() $config = ConfigBuilder::build($this->composer); $manager = IgnoreFactory::create($config, $this->composer, $this->package, $installDir); - $this->assertTrue($manager->isEnabled()); - $this->assertFalse($manager->hasPattern()); + static::assertTrue($manager->isEnabled()); + static::assertFalse($manager->hasPattern()); $this->validateInstallDir($manager, rtrim($installDir, '/')); } @@ -155,16 +155,16 @@ public function testCreateWithEnablingOfIgnoreFiles() ), ); - $this->rootPackage->expects($this->any()) + $this->rootPackage->expects(static::any()) ->method('getConfig') - ->will($this->returnValue($config)) + ->willReturn($config) ; $config = ConfigBuilder::build($this->composer); $manager = IgnoreFactory::create($config, $this->composer, $this->package); - $this->assertTrue($manager->isEnabled()); - $this->assertFalse($manager->hasPattern()); + static::assertTrue($manager->isEnabled()); + static::assertFalse($manager->hasPattern()); $this->validateInstallDir($manager, $this->config->get('vendor-dir').'/'.$this->package->getName()); } @@ -179,16 +179,16 @@ public function testCreateWithDisablingOfIgnoreFiles() ), ); - $this->rootPackage->expects($this->any()) + $this->rootPackage->expects(static::any()) ->method('getConfig') - ->will($this->returnValue($config)) + ->willReturn($config) ; $config = ConfigBuilder::build($this->composer); $manager = IgnoreFactory::create($config, $this->composer, $this->package); - $this->assertFalse($manager->isEnabled()); - $this->assertFalse($manager->hasPattern()); + static::assertFalse($manager->isEnabled()); + static::assertFalse($manager->hasPattern()); $this->validateInstallDir($manager, $this->config->get('vendor-dir').'/'.$this->package->getName()); } @@ -205,16 +205,16 @@ public function testCreateWithCustomIgnoreSection() ), ); - $this->rootPackage->expects($this->any()) + $this->rootPackage->expects(static::any()) ->method('getConfig') - ->will($this->returnValue($config)) + ->willReturn($config) ; $config = ConfigBuilder::build($this->composer); $manager = IgnoreFactory::create($config, $this->composer, $this->package, null, 'custom-ignore-files'); - $this->assertTrue($manager->isEnabled()); - $this->assertTrue($manager->hasPattern()); + static::assertTrue($manager->isEnabled()); + static::assertTrue($manager->hasPattern()); $this->validateInstallDir($manager, $this->config->get('vendor-dir').'/'.$this->package->getName()); } @@ -228,6 +228,6 @@ protected function validateInstallDir(IgnoreManager $manager, $installDir) $prop = $ref->getProperty('installDir'); $prop->setAccessible(true); - $this->assertSame($installDir, $prop->getValue($manager)); + static::assertSame($installDir, $prop->getValue($manager)); } } diff --git a/Tests/Installer/IgnoreManagerTest.php b/Tests/Installer/IgnoreManagerTest.php index f3c85027..aaf70779 100644 --- a/Tests/Installer/IgnoreManagerTest.php +++ b/Tests/Installer/IgnoreManagerTest.php @@ -61,36 +61,36 @@ public function testDeleteIgnoredFiles() $ignorer->cleanup(); - $this->assertFileNotExists($this->target.'/.hidden'); - $this->assertFileExists($this->target.'/CHANGELOG'); - $this->assertFileNotExists($this->target.'/README'); + static::assertFileNotExists($this->target.'/.hidden'); + static::assertFileExists($this->target.'/CHANGELOG'); + static::assertFileNotExists($this->target.'/README'); - $this->assertFileNotExists($this->target.'/lib/autoload.php'); - $this->assertFileNotExists($this->target.'/lib'); + static::assertFileNotExists($this->target.'/lib/autoload.php'); + static::assertFileNotExists($this->target.'/lib'); - $this->assertFileNotExists($this->target.'/src/.hidden'); - $this->assertFileNotExists($this->target.'/src/doc'); - $this->assertFileExists($this->target.'/src'); + static::assertFileNotExists($this->target.'/src/.hidden'); + static::assertFileNotExists($this->target.'/src/doc'); + static::assertFileExists($this->target.'/src'); - $this->assertFileNotExists($this->target.'/src/foo/.hidden'); - $this->assertFileExists($this->target.'/src/foo/empty.html'); - $this->assertFileNotExists($this->target.'/src/foo/empty.md'); - $this->assertFileNotExists($this->target.'/src/foo/empty.txt'); - $this->assertFileExists($this->target.'/src/foo/small.txt'); - $this->assertFileExists($this->target.'/src/foo'); + static::assertFileNotExists($this->target.'/src/foo/.hidden'); + static::assertFileExists($this->target.'/src/foo/empty.html'); + static::assertFileNotExists($this->target.'/src/foo/empty.md'); + static::assertFileNotExists($this->target.'/src/foo/empty.txt'); + static::assertFileExists($this->target.'/src/foo/small.txt'); + static::assertFileExists($this->target.'/src/foo'); - $this->assertFileExists($this->target.'/src/lib/empty.txt'); - $this->assertFileExists($this->target.'/src/lib'); + static::assertFileExists($this->target.'/src/lib/empty.txt'); + static::assertFileExists($this->target.'/src/lib'); - $this->assertFileExists($this->target.'/src/lib/foo/empty.txt'); - $this->assertFileExists($this->target.'/src/lib/foo/small.txt'); - $this->assertFileExists($this->target.'/src/lib/foo'); + static::assertFileExists($this->target.'/src/lib/foo/empty.txt'); + static::assertFileExists($this->target.'/src/lib/foo/small.txt'); + static::assertFileExists($this->target.'/src/lib/foo'); - $this->assertFileExists($this->target.'/src/tests/empty.html'); - $this->assertFileExists($this->target.'/src/tests'); + static::assertFileExists($this->target.'/src/tests/empty.html'); + static::assertFileExists($this->target.'/src/tests'); - $this->assertFileNotExists($this->target.'/tests/bootstrap.php'); - $this->assertFileNotExists($this->target.'/tests'); + static::assertFileNotExists($this->target.'/tests/bootstrap.php'); + static::assertFileNotExists($this->target.'/tests'); } public function testDeleteIgnoredFilesWithDisabledManager() @@ -109,36 +109,36 @@ public function testDeleteIgnoredFilesWithDisabledManager() $ignorer->cleanup(); - $this->assertFileExists($this->target.'/.hidden'); - $this->assertFileExists($this->target.'/CHANGELOG'); - $this->assertFileExists($this->target.'/README'); + static::assertFileExists($this->target.'/.hidden'); + static::assertFileExists($this->target.'/CHANGELOG'); + static::assertFileExists($this->target.'/README'); - $this->assertFileExists($this->target.'/lib/autoload.php'); - $this->assertFileExists($this->target.'/lib'); + static::assertFileExists($this->target.'/lib/autoload.php'); + static::assertFileExists($this->target.'/lib'); - $this->assertFileExists($this->target.'/src/.hidden'); - $this->assertFileExists($this->target.'/src/doc'); - $this->assertFileExists($this->target.'/src'); + static::assertFileExists($this->target.'/src/.hidden'); + static::assertFileExists($this->target.'/src/doc'); + static::assertFileExists($this->target.'/src'); - $this->assertFileExists($this->target.'/src/foo/.hidden'); - $this->assertFileExists($this->target.'/src/foo/empty.html'); - $this->assertFileExists($this->target.'/src/foo/empty.md'); - $this->assertFileExists($this->target.'/src/foo/empty.txt'); - $this->assertFileExists($this->target.'/src/foo/small.txt'); - $this->assertFileExists($this->target.'/src/foo'); + static::assertFileExists($this->target.'/src/foo/.hidden'); + static::assertFileExists($this->target.'/src/foo/empty.html'); + static::assertFileExists($this->target.'/src/foo/empty.md'); + static::assertFileExists($this->target.'/src/foo/empty.txt'); + static::assertFileExists($this->target.'/src/foo/small.txt'); + static::assertFileExists($this->target.'/src/foo'); - $this->assertFileExists($this->target.'/src/lib/empty.txt'); - $this->assertFileExists($this->target.'/src/lib'); + static::assertFileExists($this->target.'/src/lib/empty.txt'); + static::assertFileExists($this->target.'/src/lib'); - $this->assertFileExists($this->target.'/src/lib/foo/empty.txt'); - $this->assertFileExists($this->target.'/src/lib/foo/small.txt'); - $this->assertFileExists($this->target.'/src/lib/foo'); + static::assertFileExists($this->target.'/src/lib/foo/empty.txt'); + static::assertFileExists($this->target.'/src/lib/foo/small.txt'); + static::assertFileExists($this->target.'/src/lib/foo'); - $this->assertFileExists($this->target.'/src/tests/empty.html'); - $this->assertFileExists($this->target.'/src/tests'); + static::assertFileExists($this->target.'/src/tests/empty.html'); + static::assertFileExists($this->target.'/src/tests'); - $this->assertFileExists($this->target.'/tests/bootstrap.php'); - $this->assertFileExists($this->target.'/tests'); + static::assertFileExists($this->target.'/tests/bootstrap.php'); + static::assertFileExists($this->target.'/tests'); } public function testIgnoreAllFilesExceptAFew() @@ -152,36 +152,36 @@ public function testIgnoreAllFilesExceptAFew() $ignorer->cleanup(); - $this->assertFileNotExists($this->target.'/.hidden'); - $this->assertFileNotExists($this->target.'/CHANGELOG'); - $this->assertFileExists($this->target.'/README'); + static::assertFileNotExists($this->target.'/.hidden'); + static::assertFileNotExists($this->target.'/CHANGELOG'); + static::assertFileExists($this->target.'/README'); - $this->assertFileExists($this->target.'/lib/autoload.php'); - $this->assertFileExists($this->target.'/lib'); + static::assertFileExists($this->target.'/lib/autoload.php'); + static::assertFileExists($this->target.'/lib'); - $this->assertFileNotExists($this->target.'/src/.hidden'); - $this->assertFileNotExists($this->target.'/src/doc'); - $this->assertFileNotExists($this->target.'/src'); + static::assertFileNotExists($this->target.'/src/.hidden'); + static::assertFileNotExists($this->target.'/src/doc'); + static::assertFileNotExists($this->target.'/src'); - $this->assertFileNotExists($this->target.'/src/foo/.hidden'); - $this->assertFileNotExists($this->target.'/src/foo/empty.html'); - $this->assertFileNotExists($this->target.'/src/foo/empty.md'); - $this->assertFileNotExists($this->target.'/src/foo/empty.txt'); - $this->assertFileNotExists($this->target.'/src/foo/small.txt'); - $this->assertFileNotExists($this->target.'/src/foo'); + static::assertFileNotExists($this->target.'/src/foo/.hidden'); + static::assertFileNotExists($this->target.'/src/foo/empty.html'); + static::assertFileNotExists($this->target.'/src/foo/empty.md'); + static::assertFileNotExists($this->target.'/src/foo/empty.txt'); + static::assertFileNotExists($this->target.'/src/foo/small.txt'); + static::assertFileNotExists($this->target.'/src/foo'); - $this->assertFileNotExists($this->target.'/src/lib/empty.txt'); - $this->assertFileNotExists($this->target.'/src/lib'); + static::assertFileNotExists($this->target.'/src/lib/empty.txt'); + static::assertFileNotExists($this->target.'/src/lib'); - $this->assertFileNotExists($this->target.'/src/lib/foo/empty.txt'); - $this->assertFileNotExists($this->target.'/src/lib/foo/small.txt'); - $this->assertFileNotExists($this->target.'/src/lib/foo'); + static::assertFileNotExists($this->target.'/src/lib/foo/empty.txt'); + static::assertFileNotExists($this->target.'/src/lib/foo/small.txt'); + static::assertFileNotExists($this->target.'/src/lib/foo'); - $this->assertFileNotExists($this->target.'/src/tests/empty.html'); - $this->assertFileNotExists($this->target.'/src/tests'); + static::assertFileNotExists($this->target.'/src/tests/empty.html'); + static::assertFileNotExists($this->target.'/src/tests'); - $this->assertFileExists($this->target.'/tests/bootstrap.php'); - $this->assertFileExists($this->target.'/tests'); + static::assertFileExists($this->target.'/tests/bootstrap.php'); + static::assertFileExists($this->target.'/tests'); } public function testIgnoreAllFilesExceptAFewWithDoubleAsterisks() @@ -193,36 +193,36 @@ public function testIgnoreAllFilesExceptAFewWithDoubleAsterisks() $ignorer->cleanup(); - $this->assertFileExists($this->target.'/.hidden'); - $this->assertFileNotExists($this->target.'/CHANGELOG'); - $this->assertFileNotExists($this->target.'/README'); + static::assertFileExists($this->target.'/.hidden'); + static::assertFileNotExists($this->target.'/CHANGELOG'); + static::assertFileNotExists($this->target.'/README'); - $this->assertFileNotExists($this->target.'/lib/autoload.php'); - $this->assertFileNotExists($this->target.'/lib'); + static::assertFileNotExists($this->target.'/lib/autoload.php'); + static::assertFileNotExists($this->target.'/lib'); - $this->assertFileNotExists($this->target.'/src/.hidden'); - $this->assertFileNotExists($this->target.'/src/doc'); - $this->assertFileExists($this->target.'/src'); + static::assertFileNotExists($this->target.'/src/.hidden'); + static::assertFileNotExists($this->target.'/src/doc'); + static::assertFileExists($this->target.'/src'); - $this->assertFileNotExists($this->target.'/src/foo/.hidden'); - $this->assertFileNotExists($this->target.'/src/foo/empty.html'); - $this->assertFileNotExists($this->target.'/src/foo/empty.md'); - $this->assertFileExists($this->target.'/src/foo/empty.txt'); - $this->assertFileExists($this->target.'/src/foo/small.txt'); - $this->assertFileExists($this->target.'/src/foo'); + static::assertFileNotExists($this->target.'/src/foo/.hidden'); + static::assertFileNotExists($this->target.'/src/foo/empty.html'); + static::assertFileNotExists($this->target.'/src/foo/empty.md'); + static::assertFileExists($this->target.'/src/foo/empty.txt'); + static::assertFileExists($this->target.'/src/foo/small.txt'); + static::assertFileExists($this->target.'/src/foo'); - $this->assertFileNotExists($this->target.'/src/lib/empty.txt'); - $this->assertFileNotExists($this->target.'/src/lib'); + static::assertFileNotExists($this->target.'/src/lib/empty.txt'); + static::assertFileNotExists($this->target.'/src/lib'); - $this->assertFileNotExists($this->target.'/src/lib/foo/empty.txt'); - $this->assertFileNotExists($this->target.'/src/lib/foo/small.txt'); - $this->assertFileNotExists($this->target.'/src/lib/foo'); + static::assertFileNotExists($this->target.'/src/lib/foo/empty.txt'); + static::assertFileNotExists($this->target.'/src/lib/foo/small.txt'); + static::assertFileNotExists($this->target.'/src/lib/foo'); - $this->assertFileNotExists($this->target.'/src/tests/empty.html'); - $this->assertFileNotExists($this->target.'/src/tests'); + static::assertFileNotExists($this->target.'/src/tests/empty.html'); + static::assertFileNotExists($this->target.'/src/tests'); - $this->assertFileNotExists($this->target.'/tests/bootstrap.php'); - $this->assertFileNotExists($this->target.'/tests'); + static::assertFileNotExists($this->target.'/tests/bootstrap.php'); + static::assertFileNotExists($this->target.'/tests'); } /** diff --git a/Tests/Package/LazyCompletePackageTest.php b/Tests/Package/LazyCompletePackageTest.php index 96837dae..d98370bb 100644 --- a/Tests/Package/LazyCompletePackageTest.php +++ b/Tests/Package/LazyCompletePackageTest.php @@ -67,51 +67,51 @@ public function testMissingAssetType($lazyType) $loader = $this->getMockBuilder('Fxp\Composer\AssetPlugin\Package\Loader\LazyLoaderInterface')->getMock(); $loader - ->expects($this->any()) + ->expects(static::any()) ->method('load') - ->will($this->returnValue($lp)) + ->willReturn($lp) ; /* @var LazyLoaderInterface$loader */ $this->package->setLoader($loader); } - $this->assertSame('library', $this->package->getType()); - $this->assertSame(array(), $this->package->getTransportOptions()); - $this->assertNull($this->package->getTargetDir()); - $this->assertSame(array(), $this->package->getExtra()); - $this->assertSame(array(), $this->package->getBinaries()); - $this->assertNull($this->package->getInstallationSource()); - $this->assertNull($this->package->getSourceType()); - $this->assertNull($this->package->getSourceUrl()); - $this->assertNull($this->package->getSourceReference()); - $this->assertNull($this->package->getSourceMirrors()); - $this->assertSame(array(), $this->package->getSourceUrls()); - $this->assertNull($this->package->getDistType()); - $this->assertNull($this->package->getDistUrl()); - $this->assertNull($this->package->getDistReference()); - $this->assertNull($this->package->getDistSha1Checksum()); - $this->assertNull($this->package->getDistMirrors()); - $this->assertSame(array(), $this->package->getDistUrls()); - $this->assertNull($this->package->getReleaseDate()); - $this->assertSame(array(), $this->package->getRequires()); - $this->assertSame(array(), $this->package->getConflicts()); - $this->assertSame(array(), $this->package->getProvides()); - $this->assertSame(array(), $this->package->getReplaces()); - $this->assertSame(array(), $this->package->getDevRequires()); - $this->assertSame(array(), $this->package->getSuggests()); - $this->assertSame(array(), $this->package->getAutoload()); - $this->assertSame(array(), $this->package->getDevAutoload()); - $this->assertSame(array(), $this->package->getIncludePaths()); - $this->assertNull($this->package->getNotificationUrl()); - $this->assertSame(array(), $this->package->getArchiveExcludes()); - $this->assertSame(array(), $this->package->getScripts()); - $this->assertNull($this->package->getRepositories()); - $this->assertSame(array(), $this->package->getLicense()); - $this->assertNull($this->package->getKeywords()); - $this->assertNull($this->package->getAuthors()); - $this->assertNull($this->package->getDescription()); - $this->assertNull($this->package->getHomepage()); - $this->assertSame(array(), $this->package->getSupport()); + static::assertSame('library', $this->package->getType()); + static::assertSame(array(), $this->package->getTransportOptions()); + static::assertNull($this->package->getTargetDir()); + static::assertSame(array(), $this->package->getExtra()); + static::assertSame(array(), $this->package->getBinaries()); + static::assertNull($this->package->getInstallationSource()); + static::assertNull($this->package->getSourceType()); + static::assertNull($this->package->getSourceUrl()); + static::assertNull($this->package->getSourceReference()); + static::assertNull($this->package->getSourceMirrors()); + static::assertSame(array(), $this->package->getSourceUrls()); + static::assertNull($this->package->getDistType()); + static::assertNull($this->package->getDistUrl()); + static::assertNull($this->package->getDistReference()); + static::assertNull($this->package->getDistSha1Checksum()); + static::assertNull($this->package->getDistMirrors()); + static::assertSame(array(), $this->package->getDistUrls()); + static::assertNull($this->package->getReleaseDate()); + static::assertSame(array(), $this->package->getRequires()); + static::assertSame(array(), $this->package->getConflicts()); + static::assertSame(array(), $this->package->getProvides()); + static::assertSame(array(), $this->package->getReplaces()); + static::assertSame(array(), $this->package->getDevRequires()); + static::assertSame(array(), $this->package->getSuggests()); + static::assertSame(array(), $this->package->getAutoload()); + static::assertSame(array(), $this->package->getDevAutoload()); + static::assertSame(array(), $this->package->getIncludePaths()); + static::assertNull($this->package->getNotificationUrl()); + static::assertSame(array(), $this->package->getArchiveExcludes()); + static::assertSame(array(), $this->package->getScripts()); + static::assertNull($this->package->getRepositories()); + static::assertSame(array(), $this->package->getLicense()); + static::assertNull($this->package->getKeywords()); + static::assertNull($this->package->getAuthors()); + static::assertNull($this->package->getDescription()); + static::assertNull($this->package->getHomepage()); + static::assertSame(array(), $this->package->getSupport()); } } diff --git a/Tests/Package/Loader/LazyAssetPackageLoaderTest.php b/Tests/Package/Loader/LazyAssetPackageLoaderTest.php index f02992cf..1f3b38b1 100644 --- a/Tests/Package/Loader/LazyAssetPackageLoaderTest.php +++ b/Tests/Package/Loader/LazyAssetPackageLoaderTest.php @@ -76,7 +76,7 @@ protected function setUp() $this->assetRepositoryManager = $this->getMockBuilder(AssetRepositoryManager::class) ->disableOriginalConstructor()->getMock(); - $this->assetRepositoryManager->expects($this->any()) + $this->assetRepositoryManager->expects(static::any()) ->method('solveResolutions') ->willReturnCallback(function ($value) { return $value; @@ -84,89 +84,89 @@ protected function setUp() ; $this->lazyPackage - ->expects($this->any()) + ->expects(static::any()) ->method('getName') - ->will($this->returnValue('PACKAGE_NAME')) + ->willReturn('PACKAGE_NAME') ; $this->lazyPackage - ->expects($this->any()) + ->expects(static::any()) ->method('getUniqueName') - ->will($this->returnValue('PACKAGE_NAME-1.0.0.0')) + ->willReturn('PACKAGE_NAME-1.0.0.0') ; $this->lazyPackage - ->expects($this->any()) + ->expects(static::any()) ->method('getPrettyVersion') - ->will($this->returnValue('1.0')) + ->willReturn('1.0') ; $this->lazyPackage - ->expects($this->any()) + ->expects(static::any()) ->method('getVersion') - ->will($this->returnValue('1.0.0.0')) + ->willReturn('1.0.0.0') ; $versionConverter = $this->getMockBuilder(VersionConverterInterface::class)->getMock(); - $versionConverter->expects($this->any()) + $versionConverter->expects(static::any()) ->method('convertVersion') - ->will($this->returnValue('VERSION_CONVERTED')) + ->willReturn('VERSION_CONVERTED') ; - $versionConverter->expects($this->any()) + $versionConverter->expects(static::any()) ->method('convertRange') - ->will($this->returnCallback(function ($value) { + ->willReturnCallback(function ($value) { return $value; - })) + }) ; $packageConverter = $this->getMockBuilder(PackageConverterInterface::class)->getMock(); /** @var LazyPackageInterface $lasyPackage */ $lasyPackage = $this->lazyPackage; - $packageConverter->expects($this->any()) + $packageConverter->expects(static::any()) ->method('convert') - ->will($this->returnCallback(function ($value) use ($lasyPackage) { + ->willReturnCallback(function ($value) use ($lasyPackage) { $value['version'] = $lasyPackage->getPrettyVersion(); $value['version_normalized'] = $lasyPackage->getVersion(); return $value; - })) + }) ; - $this->assetType->expects($this->any()) + $this->assetType->expects(static::any()) ->method('getComposerVendorName') - ->will($this->returnValue('ASSET')) + ->willReturn('ASSET') ; - $this->assetType->expects($this->any()) + $this->assetType->expects(static::any()) ->method('getComposerType') - ->will($this->returnValue('ASSET_TYPE')) + ->willReturn('ASSET_TYPE') ; - $this->assetType->expects($this->any()) + $this->assetType->expects(static::any()) ->method('getFilename') - ->will($this->returnValue('ASSET.json')) + ->willReturn('ASSET.json') ; - $this->assetType->expects($this->any()) + $this->assetType->expects(static::any()) ->method('getVersionConverter') - ->will($this->returnValue($versionConverter)) + ->willReturn($versionConverter) ; - $this->assetType->expects($this->any()) + $this->assetType->expects(static::any()) ->method('getPackageConverter') - ->will($this->returnValue($packageConverter)) + ->willReturn($packageConverter) ; $this->driver - ->expects($this->any()) + ->expects(static::any()) ->method('getDist') - ->will($this->returnCallback(function ($value) { + ->willReturnCallback(function ($value) { return array( 'type' => 'vcs', 'url' => 'http://foobar.tld/dist/'.$value, ); - })) + }) ; $this->driver - ->expects($this->any()) + ->expects(static::any()) ->method('getSource') - ->will($this->returnCallback(function ($value) { + ->willReturnCallback(function ($value) { return array( 'type' => 'vcs', 'url' => 'http://foobar.tld/source/'.$value, ); - })) + }) ; } @@ -259,23 +259,23 @@ public function testWithoutJsonFile($verbose) /** @var \PHPUnit_Framework_MockObject_MockObject $driver */ $driver = $this->driver; $driver - ->expects($this->any()) + ->expects(static::any()) ->method('getComposerInformation') - ->will($this->returnValue(false)) + ->willReturn(false) ; /** @var \PHPUnit_Framework_MockObject_MockObject $loader */ $loader = $this->loader; $loader - ->expects($this->any()) + ->expects(static::any()) ->method('load') - ->will($this->returnValue(false)) + ->willReturn(false) ; $this->lazyLoader = $this->createLazyLoaderConfigured('TYPE', $verbose); $package = $this->lazyLoader->load($this->lazyPackage); - $this->assertFalse($package); + static::assertFalse($package); $filename = $this->assetType->getFilename(); $validOutput = array(''); @@ -287,11 +287,11 @@ public function testWithoutJsonFile($verbose) '', ); } - $this->assertSame($validOutput, $this->io->getTraces()); + static::assertSame($validOutput, $this->io->getTraces()); $packageCache = $this->lazyLoader->load($this->lazyPackage); - $this->assertFalse($packageCache); - $this->assertSame($validOutput, $this->io->getTraces()); + static::assertFalse($packageCache); + static::assertSame($validOutput, $this->io->getTraces()); } /** @@ -308,40 +308,40 @@ public function testWithJsonFile($verbose) $realPackage = $this->getMockBuilder(CompletePackageInterface::class)->getMock(); $realPackage - ->expects($this->any()) + ->expects(static::any()) ->method('getName') - ->will($this->returnValue('PACKAGE_NAME')) + ->willReturn('PACKAGE_NAME') ; $realPackage - ->expects($this->any()) + ->expects(static::any()) ->method('getUniqueName') - ->will($this->returnValue('PACKAGE_NAME-1.0.0.0')) + ->willReturn('PACKAGE_NAME-1.0.0.0') ; $realPackage - ->expects($this->any()) + ->expects(static::any()) ->method('getPrettyVersion') - ->will($this->returnValue('1.0')) + ->willReturn('1.0') ; $realPackage - ->expects($this->any()) + ->expects(static::any()) ->method('getVersion') - ->will($this->returnValue('1.0.0.0')) + ->willReturn('1.0.0.0') ; /** @var \PHPUnit_Framework_MockObject_MockObject $driver */ $driver = $this->driver; $driver - ->expects($this->any()) + ->expects(static::any()) ->method('getComposerInformation') - ->will($this->returnValue($arrayPackage)) + ->willReturn($arrayPackage) ; /** @var \PHPUnit_Framework_MockObject_MockObject $loader */ $loader = $this->loader; $loader - ->expects($this->any()) + ->expects(static::any()) ->method('load') - ->will($this->returnValue($realPackage)) + ->willReturn($realPackage) ; $this->lazyLoader = $this->createLazyLoaderConfigured('TYPE', $verbose); @@ -358,13 +358,13 @@ public function testWithJsonFile($verbose) ); } - $this->assertInstanceOf('Composer\Package\CompletePackageInterface', $package); - $this->assertSame($validOutput, $this->io->getTraces()); + static::assertInstanceOf('Composer\Package\CompletePackageInterface', $package); + static::assertSame($validOutput, $this->io->getTraces()); $packageCache = $this->lazyLoader->load($this->lazyPackage); - $this->assertInstanceOf('Composer\Package\CompletePackageInterface', $packageCache); - $this->assertSame($package, $packageCache); - $this->assertSame($validOutput, $this->io->getTraces()); + static::assertInstanceOf('Composer\Package\CompletePackageInterface', $packageCache); + static::assertSame($package, $packageCache); + static::assertSame($validOutput, $this->io->getTraces()); } public function getConfigIoForException() @@ -394,15 +394,15 @@ public function testTagWithTransportException($type, $verbose, $exceptionClass, /** @var \PHPUnit_Framework_MockObject_MockObject $loader */ $loader = $this->loader; $loader - ->expects($this->any()) + ->expects(static::any()) ->method('load') - ->will($this->throwException(new $exceptionClass('MESSAGE'))) + ->will(static::throwException(new $exceptionClass('MESSAGE'))) ; $this->lazyLoader = $this->createLazyLoaderConfigured($type, $verbose); $package = $this->lazyLoader->load($this->lazyPackage); - $this->assertFalse($package); + static::assertFalse($package); $filename = $this->assetType->getFilename(); $validOutput = array(''); @@ -415,11 +415,11 @@ public function testTagWithTransportException($type, $verbose, $exceptionClass, '', ); } - $this->assertSame($validOutput, $this->io->getTraces()); + static::assertSame($validOutput, $this->io->getTraces()); $packageCache = $this->lazyLoader->load($this->lazyPackage); - $this->assertFalse($packageCache); - $this->assertSame($validOutput, $this->io->getTraces()); + static::assertFalse($packageCache); + static::assertSame($validOutput, $this->io->getTraces()); } /** diff --git a/Tests/Repository/AbstractAssetsRepositoryTest.php b/Tests/Repository/AbstractAssetsRepositoryTest.php index a6cc8110..8ca1e6dd 100644 --- a/Tests/Repository/AbstractAssetsRepositoryTest.php +++ b/Tests/Repository/AbstractAssetsRepositoryTest.php @@ -63,9 +63,9 @@ abstract class AbstractAssetsRepositoryTest extends \PHPUnit\Framework\TestCase protected function setUp() { $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isVerbose') - ->will($this->returnValue(true)) + ->willReturn(true) ; /** @var IOInterface $io */ $config = new Config(); @@ -105,12 +105,12 @@ protected function tearDown() public function testFindPackageMustBeAlwaysNull() { - $this->assertNull($this->registry->findPackage('foobar', '0')); + static::assertNull($this->registry->findPackage('foobar', '0')); } public function testFindPackageMustBeAlwaysEmpty() { - $this->assertCount(0, $this->registry->findPackages('foobar', '0')); + static::assertCount(0, $this->registry->findPackages('foobar', '0')); } /** @@ -123,62 +123,62 @@ public function testGetPackagesNotBeUsed() public function testGetProviderNamesMustBeEmpty() { - $this->assertCount(0, $this->registry->getProviderNames()); + static::assertCount(0, $this->registry->getProviderNames()); } public function testGetMinimalPackagesMustBeAlwaysEmpty() { - $this->assertCount(0, $this->registry->getMinimalPackages()); + static::assertCount(0, $this->registry->getMinimalPackages()); } public function testWhatProvidesWithNotAssetName() { - $this->assertCount(0, $this->registry->whatProvides($this->pool, 'foo/bar')); + static::assertCount(0, $this->registry->whatProvides($this->pool, 'foo/bar')); } public function testWhatProvidesWithNonExistentPackage() { $name = $this->getType().'-asset/non-existent'; $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->throwException(new TransportException('Package not found'))) + ->will(static::throwException(new TransportException('Package not found'))) ; - $this->assertCount(0, $this->rm->getRepositories()); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(0, $this->rm->getRepositories()); + static::assertCount(0, $this->rm->getRepositories()); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(0, $this->rm->getRepositories()); } public function testWhatProvidesWithExistingPackage() { $name = $this->getType().'-asset/existing'; $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->returnValue(json_encode($this->getMockPackageForVcsConfig()))) + ->willReturn(json_encode($this->getMockPackageForVcsConfig())) ; - $this->assertCount(0, $this->rm->getRepositories()); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(1, $this->rm->getRepositories()); + static::assertCount(0, $this->rm->getRepositories()); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(1, $this->rm->getRepositories()); } public function testWhatProvidesWithExistingAliasPackage() { $name = $this->getType().'-asset/existing-1.0'; $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->returnValue(json_encode($this->getMockPackageForVcsConfig()))) + ->willReturn(json_encode($this->getMockPackageForVcsConfig())) ; - $this->assertCount(0, $this->rm->getRepositories()); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(1, $this->rm->getRepositories()); + static::assertCount(0, $this->rm->getRepositories()); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(1, $this->rm->getRepositories()); } public function testWhatProvidesWithCamelcasePackageName() @@ -186,55 +186,55 @@ public function testWhatProvidesWithCamelcasePackageName() $assetName = 'CamelCasePackage'; $name = $this->getType().'-asset/'.strtolower($assetName); $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->at(0)) + $rfs->expects(static::at(0)) ->method('getContents') - ->will($this->throwException(new TransportException('Package not found', 404))) + ->will(static::throwException(new TransportException('Package not found', 404))) ; - $rfs->expects($this->at(1)) + $rfs->expects(static::at(1)) ->method('getContents') - ->will($this->throwException(new TransportException('Package not found', 404))) + ->will(static::throwException(new TransportException('Package not found', 404))) ; - $rfs->expects($this->at(2)) + $rfs->expects(static::at(2)) ->method('getContents') - ->will($this->throwException(new TransportException('Package not found', 404))) + ->will(static::throwException(new TransportException('Package not found', 404))) ; - $rfs->expects($this->at(3)) + $rfs->expects(static::at(3)) ->method('getContents') - ->will($this->returnValue(json_encode($this->getMockSearchResult($assetName)))) + ->willReturn(json_encode($this->getMockSearchResult($assetName))) ; - $rfs->expects($this->at(4)) + $rfs->expects(static::at(4)) ->method('getContents') - ->will($this->returnValue(json_encode($this->getMockPackageForVcsConfig()))) + ->willReturn(json_encode($this->getMockPackageForVcsConfig())) ; - $this->assertCount(0, $this->rm->getRepositories()); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(1, $this->rm->getRepositories()); + static::assertCount(0, $this->rm->getRepositories()); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(1, $this->rm->getRepositories()); } public function testSearch() { $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->returnValue(json_encode($this->getMockSearchResult()))) + ->willReturn(json_encode($this->getMockSearchResult())) ; $result = $this->registry->search('query'); - $this->assertCount(\count($this->getMockSearchResult()), $result); + static::assertCount(\count($this->getMockSearchResult()), $result); } public function testSearchWithAssetComposerPrefix() { $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->returnValue(json_encode($this->getMockSearchResult()))) + ->willReturn(json_encode($this->getMockSearchResult())) ; $result = $this->registry->search($this->getType().'-asset/query'); - $this->assertCount(\count($this->getMockSearchResult()), $result); + static::assertCount(\count($this->getMockSearchResult()), $result); } public function testSearchWithSearchDisabled() @@ -247,16 +247,16 @@ public function testSearchWithSearchDisabled() ); $this->registry = $this->getRegistry($repoConfig, $this->io, $this->config); - $this->assertCount(0, $this->registry->search('query')); + static::assertCount(0, $this->registry->search('query')); } public function testOverridingVcsRepositoryConfig() { $name = $this->getType().'-asset/foobar'; $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->returnValue(json_encode($this->getMockPackageForVcsConfig()))) + ->willReturn(json_encode($this->getMockPackageForVcsConfig())) ; $repo = $this->getMockBuilder('Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository') @@ -264,15 +264,15 @@ public function testOverridingVcsRepositoryConfig() ->getMock() ; - $repo->expects($this->any()) + $repo->expects(static::any()) ->method('getComposerPackageName') - ->will($this->returnValue($name)) + ->willReturn($name) ; /* @var AssetVcsRepository $repo */ $this->rm->addRepository($repo); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); } protected function getCustomRepoConfig() diff --git a/Tests/Repository/AssetRepositoryManagerTest.php b/Tests/Repository/AssetRepositoryManagerTest.php index 71df1882..d4e9e89f 100644 --- a/Tests/Repository/AssetRepositoryManagerTest.php +++ b/Tests/Repository/AssetRepositoryManagerTest.php @@ -91,20 +91,20 @@ public function testSolveResolutions($withResolutionManager) if ($withResolutionManager) { $this->assetRepositoryManager->setResolutionManager($this->resolutionManager); - $this->resolutionManager->expects($this->once()) + $this->resolutionManager->expects(static::once()) ->method('solveResolutions') ->with($expected) ->willReturn($expected) ; } else { - $this->resolutionManager->expects($this->never()) + $this->resolutionManager->expects(static::never()) ->method('solveResolutions') ; } $data = $this->assetRepositoryManager->solveResolutions($expected); - $this->assertSame($expected, $data); + static::assertSame($expected, $data); } public function testAddRepositoryInPool() @@ -124,7 +124,7 @@ public function testAddRepositoryInPool() $repo = $this->getMockBuilder(RepositoryInterface::class)->getMock(); - $this->rm->expects($this->once()) + $this->rm->expects(static::once()) ->method('createRepository') ->with('asset-vcs', $repoConfigExpected) ->willReturn($repo) @@ -134,7 +134,7 @@ public function testAddRepositoryInPool() /** @var \PHPUnit_Framework_MockObject_MockObject|Pool $pool */ $pool = $this->getMockBuilder(Pool::class)->disableOriginalConstructor()->getMock(); - $pool->expects($this->once()) + $pool->expects(static::once()) ->method('addRepository') ->with($repo) ; @@ -144,6 +144,6 @@ public function testAddRepositoryInPool() public function testGetConfig() { - $this->assertSame($this->config, $this->assetRepositoryManager->getConfig()); + static::assertSame($this->config, $this->assetRepositoryManager->getConfig()); } } diff --git a/Tests/Repository/AssetVcsRepositoryTest.php b/Tests/Repository/AssetVcsRepositoryTest.php index 79a477fe..5decd71a 100644 --- a/Tests/Repository/AssetVcsRepositoryTest.php +++ b/Tests/Repository/AssetVcsRepositoryTest.php @@ -71,7 +71,7 @@ protected function setUp() ->getMock() ; - $this->assetRepositoryManager->expects($this->any()) + $this->assetRepositoryManager->expects(static::any()) ->method('solveResolutions') ->willReturnCallback(function ($value) { return $value; @@ -111,7 +111,7 @@ public function getDefaultDrivers() public function testDefaultConstructor($type, $url) { $this->init(false, $type, $url, '', false, array()); - $this->assertEquals(0, $this->repository->count()); + static::assertEquals(0, $this->repository->count()); } /** @@ -198,7 +198,7 @@ public function testSkipParsingFile($type, $url, $class, $verbose) } catch (InvalidRepositoryException $e) { // for analysis the IO traces } - $this->assertSame($validTraces, $this->io->getTraces()); + static::assertSame($validTraces, $this->io->getTraces()); } /** @@ -231,7 +231,7 @@ public function testRepositoryPackageName($type, $url, $class, $verbose) $this->init(true, $type, $url, $class, $verbose, null, $packageName); - $this->assertEquals($valid, $this->repository->getComposerPackageName()); + static::assertEquals($valid, $this->repository->getComposerPackageName()); } /** @@ -257,18 +257,18 @@ public function testWithTagsAndBranchs($type, $url, $class, $verbose) /** @var PackageInterface[] $packages */ $packages = $this->repository->getPackages(); - $this->assertCount(7, $packages); + static::assertCount(7, $packages); foreach ($packages as $package) { if ($package instanceof AliasPackage) { $package = $package->getAliasOf(); } - $this->assertInstanceOf('Composer\Package\CompletePackage', $package); - $this->assertSame($validPackageName, $package->getName()); + static::assertInstanceOf('Composer\Package\CompletePackage', $package); + static::assertSame($validPackageName, $package->getName()); } - $this->assertSame($validTraces, $this->io->getTraces()); + static::assertSame($validTraces, $this->io->getTraces()); } /** @@ -309,18 +309,18 @@ public function testWithTagsAndBranchsWithoutPackageName($type, $url, $class, $v /** @var PackageInterface[] $packages */ $packages = $this->repository->getPackages(); - $this->assertCount(7, $packages); + static::assertCount(7, $packages); foreach ($packages as $package) { if ($package instanceof AliasPackage) { $package = $package->getAliasOf(); } - $this->assertInstanceOf('Composer\Package\CompletePackage', $package); - $this->assertSame($validPackageName, $package->getName()); + static::assertInstanceOf('Composer\Package\CompletePackage', $package); + static::assertSame($validPackageName, $package->getName()); } - $this->assertSame($validTraces, $this->io->getTraces()); + static::assertSame($validTraces, $this->io->getTraces()); } /** @@ -346,18 +346,18 @@ public function testWithTagsAndBranchsWithRegistryPackageName($type, $url, $clas /** @var PackageInterface[] $packages */ $packages = $this->repository->getPackages(); - $this->assertCount(7, $packages); + static::assertCount(7, $packages); foreach ($packages as $package) { if ($package instanceof AliasPackage) { $package = $package->getAliasOf(); } - $this->assertInstanceOf('Composer\Package\CompletePackage', $package); - $this->assertSame($validPackageName, $package->getName()); + static::assertInstanceOf('Composer\Package\CompletePackage', $package); + static::assertSame($validPackageName, $package->getName()); } - $this->assertSame($validTraces, $this->io->getTraces()); + static::assertSame($validTraces, $this->io->getTraces()); } /** @@ -381,9 +381,9 @@ public function testWithFilterTags($type, $url, $class, $verbose) ->getMock() ; - $filter->expects($this->any()) + $filter->expects(static::any()) ->method('skip') - ->will($this->returnValue(true)) + ->willReturn(true) ; /* @var VcsPackageFilter $filter */ @@ -391,18 +391,18 @@ public function testWithFilterTags($type, $url, $class, $verbose) /** @var PackageInterface[] $packages */ $packages = $this->repository->getPackages(); - $this->assertCount(5, $packages); + static::assertCount(5, $packages); foreach ($packages as $package) { if ($package instanceof AliasPackage) { $package = $package->getAliasOf(); } - $this->assertInstanceOf('Composer\Package\CompletePackage', $package); - $this->assertSame($validPackageName, $package->getName()); + static::assertInstanceOf('Composer\Package\CompletePackage', $package); + static::assertSame($validPackageName, $package->getName()); } - $this->assertSame($validTraces, $this->io->getTraces()); + static::assertSame($validTraces, $this->io->getTraces()); } /** @@ -431,8 +431,8 @@ public function testPackageWithRegistryVersions($type, $url, $class) /** @var PackageInterface[] $packages */ $packages = $this->repository->getPackages(); - $this->assertCount(10, $packages); - $this->assertSame($registryPackages, $packages); + static::assertCount(10, $packages); + static::assertSame($registryPackages, $packages); } /** diff --git a/Tests/Repository/BowerPrivateRepositoryTest.php b/Tests/Repository/BowerPrivateRepositoryTest.php index 2c1e04ef..f93e70fd 100644 --- a/Tests/Repository/BowerPrivateRepositoryTest.php +++ b/Tests/Repository/BowerPrivateRepositoryTest.php @@ -33,9 +33,9 @@ public function testWhatProvidesWithInvalidPrivateUrl() { $name = $this->getType().'-asset/existing'; $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->returnValue(json_encode(array()))) + ->willReturn(json_encode(array())) ; $this->registry->whatProvides($this->pool, $name); diff --git a/Tests/Repository/NpmRepositoryTest.php b/Tests/Repository/NpmRepositoryTest.php index 5ab447b6..3a2d405d 100644 --- a/Tests/Repository/NpmRepositoryTest.php +++ b/Tests/Repository/NpmRepositoryTest.php @@ -30,24 +30,24 @@ public function testWhatProvidesWithCamelcasePackageName() { $name = $this->getType().'-asset/CamelCasePackage'; $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->throwException(new TransportException('Package not found', 404))) + ->will(static::throwException(new TransportException('Package not found', 404))) ; - $this->assertCount(0, $this->rm->getRepositories()); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(0, $this->rm->getRepositories()); + static::assertCount(0, $this->rm->getRepositories()); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(0, $this->rm->getRepositories()); } public function testWatProvidesWithoutRepositoryUrl() { $name = $this->getType().'-asset/foobar'; $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->returnValue(json_encode(array( + ->willReturn(json_encode(array( 'repository' => array( 'type' => 'vcs', ), @@ -65,22 +65,22 @@ public function testWatProvidesWithoutRepositoryUrl() 'time' => array( '1.0.0' => '2016-09-20T13:48:47.730Z', ), - )))) + ))) ; - $this->assertCount(0, $this->rm->getRepositories()); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(1, $this->rm->getRepositories()); + static::assertCount(0, $this->rm->getRepositories()); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(1, $this->rm->getRepositories()); } public function testWhatProvidesWithBrokenVersionConstraint() { $name = $this->getType().'-asset/foobar'; $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->returnValue(json_encode(array( + ->willReturn(json_encode(array( 'repository' => array( 'type' => 'vcs', ), @@ -121,14 +121,14 @@ public function testWhatProvidesWithBrokenVersionConstraint() 'time' => array( '1.0.0' => '2016-09-20T13:48:47.730Z', ), - )))) + ))) ; - $this->assertCount(0, $this->rm->getRepositories()); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(1, $this->rm->getRepositories()); - $this->assertCount(2, $this->rm->getRepositories()[0]->getPackages()); + static::assertCount(0, $this->rm->getRepositories()); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(1, $this->rm->getRepositories()); + static::assertCount(2, $this->rm->getRepositories()[0]->getPackages()); } /** @@ -139,12 +139,12 @@ public function testWatProvidesWithoutRepositoryUrlAndWithoutVersions() { $name = $this->getType().'-asset/foobar'; $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->returnValue(json_encode(array()))) + ->willReturn(json_encode(array())) ; - $this->assertCount(0, $this->rm->getRepositories()); + static::assertCount(0, $this->rm->getRepositories()); $this->registry->whatProvides($this->pool, $name); } @@ -153,20 +153,20 @@ public function testWhatProvidesWithGitPlusHttpsUrl() { $name = $this->getType().'-asset/existing'; $rfs = $this->replaceRegistryRfsByMock(); - $rfs->expects($this->any()) + $rfs->expects(static::any()) ->method('getContents') - ->will($this->returnValue(json_encode(array( + ->willReturn(json_encode(array( 'repository' => array( 'type' => 'vcs', 'url' => 'git+https://foo.tld', ), - )))) + ))) ; - $this->assertCount(0, $this->rm->getRepositories()); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(0, $this->registry->whatProvides($this->pool, $name)); - $this->assertCount(1, $this->rm->getRepositories()); + static::assertCount(0, $this->rm->getRepositories()); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(0, $this->registry->whatProvides($this->pool, $name)); + static::assertCount(1, $this->rm->getRepositories()); } /** diff --git a/Tests/Repository/ResolutionManagerTest.php b/Tests/Repository/ResolutionManagerTest.php index 08a6b32d..80ac7448 100644 --- a/Tests/Repository/ResolutionManagerTest.php +++ b/Tests/Repository/ResolutionManagerTest.php @@ -51,6 +51,6 @@ public function testSolveResolutions() ), ); - $this->assertSame($expected, $data); + static::assertSame($expected, $data); } } diff --git a/Tests/Repository/UtilTest.php b/Tests/Repository/UtilTest.php index fe89b09b..6411ece4 100644 --- a/Tests/Repository/UtilTest.php +++ b/Tests/Repository/UtilTest.php @@ -71,6 +71,6 @@ public function getPackageNames() */ public function testConvertAliasName($name, $validName) { - $this->assertSame($validName, Util::convertAliasName($name)); + static::assertSame($validName, Util::convertAliasName($name)); } } diff --git a/Tests/Repository/Vcs/GitBitbucketDriverTest.php b/Tests/Repository/Vcs/GitBitbucketDriverTest.php index 95ae8c2c..45944df4 100644 --- a/Tests/Repository/Vcs/GitBitbucketDriverTest.php +++ b/Tests/Repository/Vcs/GitBitbucketDriverTest.php @@ -73,9 +73,9 @@ public function testPublicRepositoryWithComposer($type, $filename) $sha = 'SOMESHA'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $remoteFilesystem = $this->getMockBuilder('Composer\Util\RemoteFilesystem') @@ -83,7 +83,7 @@ public function testPublicRepositoryWithComposer($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->any()) + $remoteFilesystem->expects(static::any()) ->method('getContents') ->withConsecutive( array( @@ -127,17 +127,17 @@ public function testPublicRepositoryWithComposer($type, $filename) '^1.7.0' => 'master', '1.6.*' => 'test_master', )); - $this->assertEquals($expectedRootIdentifier, $driver->getRootIdentifier()); + static::assertEquals($expectedRootIdentifier, $driver->getRootIdentifier()); $dist = $driver->getDist($sha); - $this->assertEquals('zip', $dist['type']); - $this->assertEquals($this->getScheme($repoBaseUrl).'/get/SOMESHA.zip', $dist['url']); - $this->assertEquals($sha, $dist['reference']); + static::assertEquals('zip', $dist['type']); + static::assertEquals($this->getScheme($repoBaseUrl).'/get/SOMESHA.zip', $dist['url']); + static::assertEquals($sha, $dist['reference']); $source = $driver->getSource($sha); - $this->assertEquals('git', $source['type']); - $this->assertEquals($repoUrl, $source['url']); - $this->assertEquals($sha, $source['reference']); + static::assertEquals('git', $source['type']); + static::assertEquals($repoUrl, $source['url']); + static::assertEquals($sha, $source['reference']); $driver->getComposerInformation($identifier); } @@ -161,14 +161,14 @@ public function testPublicRepositoryWithEmptyComposer($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') ->with( - $this->equalTo('bitbucket.org'), - $this->equalTo($repoApiUrl.'/src/'.$identifier.'/'.$filename), - $this->equalTo(false) + static::equalTo('bitbucket.org'), + static::equalTo($repoApiUrl.'/src/'.$identifier.'/'.$filename), + static::equalTo(false) ) - ->will($this->throwException(new TransportException('Not Found', 404))) + ->will(static::throwException(new TransportException('Not Found', 404))) ; $repoConfig = array( @@ -186,7 +186,7 @@ public function testPublicRepositoryWithEmptyComposer($type, $filename) '_nonexistent_package' => true, ); - $this->assertSame($validEmpty, $driver->getComposerInformation($identifier)); + static::assertSame($validEmpty, $driver->getComposerInformation($identifier)); } /** diff --git a/Tests/Repository/Vcs/GitDriverTest.php b/Tests/Repository/Vcs/GitDriverTest.php index 58f40744..48cd2120 100644 --- a/Tests/Repository/Vcs/GitDriverTest.php +++ b/Tests/Repository/Vcs/GitDriverTest.php @@ -43,7 +43,7 @@ protected function setUp() /* @var AssetRepositoryManager|\PHPUnit_Framework_MockObject_MockObject $arm */ $this->assetRepositoryManager = $this->getMockBuilder(AssetRepositoryManager::class)->disableOriginalConstructor()->getMock(); - $this->assetRepositoryManager->expects($this->any()) + $this->assetRepositoryManager->expects(static::any()) ->method('getConfig') ->willReturn($assetConfig) ; @@ -98,15 +98,15 @@ public function testPublicRepositoryWithEmptyComposer($type, $filename) ); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function () { + ->willReturnCallback(function () { return 0; - })) + }) ; /** @var IOInterface $io */ @@ -118,7 +118,7 @@ public function testPublicRepositoryWithEmptyComposer($type, $filename) '_nonexistent_package' => true, ); - $this->assertSame($validEmpty, $gitDriver->getComposerInformation($identifier)); + static::assertSame($validEmpty, $gitDriver->getComposerInformation($identifier)); } /** @@ -141,13 +141,13 @@ public function testPublicRepositoryWithSkipUpdate($type, $filename) ); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function ($command, &$output = null) use ($identifier, $repoConfig) { + ->willReturnCallback(function ($command, &$output = null) use ($identifier, $repoConfig) { if ($command === sprintf('git show %s', sprintf('%s:%s', escapeshellarg($identifier), $repoConfig['filename']))) { $output = '{"name": "foo"}'; } elseif (false !== strpos($command, 'git log')) { @@ -156,7 +156,7 @@ public function testPublicRepositoryWithSkipUpdate($type, $filename) } return 0; - })) + }) ; /** @var IOInterface $io */ @@ -174,11 +174,11 @@ public function testPublicRepositoryWithSkipUpdate($type, $filename) $composer1 = $gitDriver1->getComposerInformation($identifier); $composer2 = $gitDriver2->getComposerInformation($identifier); - $this->assertNotNull($composer1); - $this->assertNotNull($composer2); - $this->assertSame($composer1, $composer2); - $this->assertNotSame($validEmpty, $composer1); - $this->assertNotSame($validEmpty, $composer2); + static::assertNotNull($composer1); + static::assertNotNull($composer2); + static::assertSame($composer1, $composer2); + static::assertNotSame($validEmpty, $composer1); + static::assertNotSame($validEmpty, $composer2); } /** @@ -199,13 +199,13 @@ public function testPublicRepositoryWithCodeCache($type, $filename) ); $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function ($command, &$output = null) use ($identifier, $repoConfig) { + ->willReturnCallback(function ($command, &$output = null) use ($identifier, $repoConfig) { if ($command === sprintf('git show %s', sprintf('%s:%s', escapeshellarg($identifier), $repoConfig['filename']))) { $output = '{"name": "foo"}'; } elseif (false !== strpos($command, 'git log')) { @@ -214,7 +214,7 @@ public function testPublicRepositoryWithCodeCache($type, $filename) } return 0; - })) + }) ; /** @var IOInterface $io */ @@ -224,9 +224,9 @@ public function testPublicRepositoryWithCodeCache($type, $filename) $composer1 = $gitDriver->getComposerInformation($identifier); $composer2 = $gitDriver->getComposerInformation($identifier); - $this->assertNotNull($composer1); - $this->assertNotNull($composer2); - $this->assertSame($composer1, $composer2); + static::assertNotNull($composer1); + static::assertNotNull($composer2); + static::assertSame($composer1, $composer2); } /** @@ -247,13 +247,13 @@ public function testPublicRepositoryWithFilesystemCache($type, $filename) ); $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function ($command, &$output = null) use ($identifier, $repoConfig) { + ->willReturnCallback(function ($command, &$output = null) use ($identifier, $repoConfig) { if ($command === sprintf('git show %s', sprintf('%s:%s', escapeshellarg($identifier), $repoConfig['filename']))) { $output = '{"name": "foo"}'; } elseif (false !== strpos($command, 'git log')) { @@ -262,7 +262,7 @@ public function testPublicRepositoryWithFilesystemCache($type, $filename) } return 0; - })) + }) ; /** @var IOInterface $io */ @@ -274,9 +274,9 @@ public function testPublicRepositoryWithFilesystemCache($type, $filename) $composer1 = $gitDriver1->getComposerInformation($identifier); $composer2 = $gitDriver2->getComposerInformation($identifier); - $this->assertNotNull($composer1); - $this->assertNotNull($composer2); - $this->assertSame($composer1, $composer2); + static::assertNotNull($composer1); + static::assertNotNull($composer2); + static::assertSame($composer1, $composer2); } protected function setAttribute($object, $attribute, $value) diff --git a/Tests/Repository/Vcs/GitHubDriverTest.php b/Tests/Repository/Vcs/GitHubDriverTest.php index 01c527ca..1ec98c52 100644 --- a/Tests/Repository/Vcs/GitHubDriverTest.php +++ b/Tests/Repository/Vcs/GitHubDriverTest.php @@ -55,7 +55,7 @@ protected function setUp() $this->assetRepositoryManager = $this->getMockBuilder(AssetRepositoryManager::class) ->disableOriginalConstructor()->getMock(); - $this->assetRepositoryManager->expects($this->any()) + $this->assetRepositoryManager->expects(static::any()) ->method('getConfig') ->willReturn($assetConfig) ; @@ -92,9 +92,9 @@ public function testPrivateRepository($type, $filename) $sha = 'SOMESHA'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $remoteFilesystem = $this->getMockBuilder('Composer\Util\RemoteFilesystem') @@ -103,55 +103,55 @@ public function testPrivateRepository($type, $filename) ; $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnValue(1)) + ->willReturn(1) ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->will(static::throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) ; - $io->expects($this->once()) + $io->expects(static::once()) ->method('askAndHideAnswer') - ->with($this->equalTo('Token (hidden): ')) - ->will($this->returnValue('sometoken')) + ->with(static::equalTo('Token (hidden): ')) + ->willReturn('sometoken') ; - $io->expects($this->any()) + $io->expects(static::any()) ->method('setAuthentication') - ->with($this->equalTo('github.com'), $this->matchesRegularExpression('{sometoken|abcdef}'), $this->matchesRegularExpression('{x-oauth-basic}')) + ->with(static::equalTo('github.com'), static::matchesRegularExpression('{sometoken|abcdef}'), static::matchesRegularExpression('{x-oauth-basic}')) ; - $remoteFilesystem->expects($this->at(1)) + $remoteFilesystem->expects(static::at(1)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://github.com/composer-test/repo-name'), $this->equalTo(false)) - ->will($this->returnValue('')) + ->with(static::equalTo('github.com'), static::equalTo('https://github.com/composer-test/repo-name'), static::equalTo(false)) + ->willReturn('') ; - $remoteFilesystem->expects($this->at(2)) + $remoteFilesystem->expects(static::at(2)) ->method('getContents') - ->will($this->returnValue('')) + ->willReturn('') ; - $remoteFilesystem->expects($this->at(3)) + $remoteFilesystem->expects(static::at(3)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->will(static::throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) ; - $remoteFilesystem->expects($this->at(4)) + $remoteFilesystem->expects(static::at(4)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/'), $this->equalTo(false)) - ->will($this->returnValue('{}')) + ->with(static::equalTo('github.com'), static::equalTo('https://api.github.com/'), static::equalTo(false)) + ->willReturn('{}') ; - $remoteFilesystem->expects($this->at(5)) + $remoteFilesystem->expects(static::at(5)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->returnValue($this->createJsonComposer(array('master_branch' => 'test_master', 'private' => true)))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->willReturn($this->createJsonComposer(array('master_branch' => 'test_master', 'private' => true))) ; $configSource = $this->getMockBuilder('Composer\Config\ConfigSourceInterface')->getMock(); @@ -178,17 +178,17 @@ public function testPrivateRepository($type, $filename) $gitHubDriver->initialize(); $this->setAttribute($gitHubDriver, 'tags', array($identifier => $sha)); - $this->assertEquals('test_master', $gitHubDriver->getRootIdentifier()); + static::assertEquals('test_master', $gitHubDriver->getRootIdentifier()); $dist = $gitHubDriver->getDist($sha); - $this->assertEquals('zip', $dist['type']); - $this->assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); - $this->assertEquals('SOMESHA', $dist['reference']); + static::assertEquals('zip', $dist['type']); + static::assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); + static::assertEquals('SOMESHA', $dist['reference']); $source = $gitHubDriver->getSource($sha); - $this->assertEquals('git', $source['type']); - $this->assertEquals($repoSshUrl, $source['url']); - $this->assertEquals('SOMESHA', $source['reference']); + static::assertEquals('git', $source['type']); + static::assertEquals($repoSshUrl, $source['url']); + static::assertEquals('SOMESHA', $source['reference']); } /** @@ -206,9 +206,9 @@ public function testPublicRepository($type, $filename) $sha = 'SOMESHA'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $remoteFilesystem = $this->getMockBuilder('Composer\Util\RemoteFilesystem') @@ -216,10 +216,10 @@ public function testPublicRepository($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->returnValue($this->createJsonComposer(array('master_branch' => 'test_master')))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->willReturn($this->createJsonComposer(array('master_branch' => 'test_master'))) ; $repoConfig = array( @@ -237,17 +237,17 @@ public function testPublicRepository($type, $filename) $gitHubDriver->initialize(); $this->setAttribute($gitHubDriver, 'tags', array($identifier => $sha)); - $this->assertEquals('test_master', $gitHubDriver->getRootIdentifier()); + static::assertEquals('test_master', $gitHubDriver->getRootIdentifier()); $dist = $gitHubDriver->getDist($sha); - $this->assertEquals('zip', $dist['type']); - $this->assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); - $this->assertEquals($sha, $dist['reference']); + static::assertEquals('zip', $dist['type']); + static::assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); + static::assertEquals($sha, $dist['reference']); $source = $gitHubDriver->getSource($sha); - $this->assertEquals('git', $source['type']); - $this->assertEquals($repoUrl, $source['url']); - $this->assertEquals($sha, $source['reference']); + static::assertEquals('git', $source['type']); + static::assertEquals($repoUrl, $source['url']); + static::assertEquals($sha, $source['reference']); } /** @@ -265,9 +265,9 @@ public function testPublicRepository2($type, $filename) $sha = 'SOMESHA'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $remoteFilesystem = $this->getMockBuilder('Composer\Util\RemoteFilesystem') @@ -275,22 +275,22 @@ public function testPublicRepository2($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->returnValue($this->createJsonComposer(array('master_branch' => 'test_master')))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->willReturn($this->createJsonComposer(array('master_branch' => 'test_master'))) ; - $remoteFilesystem->expects($this->at(1)) + $remoteFilesystem->expects(static::at(1)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref=feature%2F3.2-foo'), $this->equalTo(false)) - ->will($this->returnValue('{"encoding":"base64","content":"'.base64_encode('{"support": {"source": "'.$repoUrl.'" }}').'"}')) + ->with(static::equalTo('github.com'), static::equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref=feature%2F3.2-foo'), static::equalTo(false)) + ->willReturn('{"encoding":"base64","content":"'.base64_encode('{"support": {"source": "'.$repoUrl.'" }}').'"}') ; - $remoteFilesystem->expects($this->at(2)) + $remoteFilesystem->expects(static::at(2)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/repos/composer-test/repo-name/commits/feature%2F3.2-foo'), $this->equalTo(false)) - ->will($this->returnValue('{"commit": {"committer":{ "date": "2012-09-10"}}}')) + ->with(static::equalTo('github.com'), static::equalTo('https://api.github.com/repos/composer-test/repo-name/commits/feature%2F3.2-foo'), static::equalTo(false)) + ->willReturn('{"commit": {"committer":{ "date": "2012-09-10"}}}') ; $repoConfig = array( @@ -308,17 +308,17 @@ public function testPublicRepository2($type, $filename) $gitHubDriver->initialize(); $this->setAttribute($gitHubDriver, 'tags', array($identifier => $sha)); - $this->assertEquals('test_master', $gitHubDriver->getRootIdentifier()); + static::assertEquals('test_master', $gitHubDriver->getRootIdentifier()); $dist = $gitHubDriver->getDist($sha); - $this->assertEquals('zip', $dist['type']); - $this->assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); - $this->assertEquals($sha, $dist['reference']); + static::assertEquals('zip', $dist['type']); + static::assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); + static::assertEquals($sha, $dist['reference']); $source = $gitHubDriver->getSource($sha); - $this->assertEquals('git', $source['type']); - $this->assertEquals($repoUrl, $source['url']); - $this->assertEquals($sha, $source['reference']); + static::assertEquals('git', $source['type']); + static::assertEquals($repoUrl, $source['url']); + static::assertEquals($sha, $source['reference']); $gitHubDriver->getComposerInformation($identifier); } @@ -344,9 +344,9 @@ public function testPrivateRepositoryNoInteraction($type, $filename) ; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(false)) + ->willReturn(false) ; $remoteFilesystem = $this->getMockBuilder('Composer\Util\RemoteFilesystem') @@ -354,73 +354,73 @@ public function testPrivateRepositoryNoInteraction($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->will(static::throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) ; - $remoteFilesystem->expects($this->at(1)) + $remoteFilesystem->expects(static::at(1)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://github.com/composer-test/repo-name'), $this->equalTo(false)) - ->will($this->returnValue('')) + ->with(static::equalTo('github.com'), static::equalTo('https://github.com/composer-test/repo-name'), static::equalTo(false)) + ->willReturn('') ; - $remoteFilesystem->expects($this->at(2)) + $remoteFilesystem->expects(static::at(2)) ->method('getContents') - ->will($this->returnValue('')) + ->willReturn('') ; - $remoteFilesystem->expects($this->at(3)) + $remoteFilesystem->expects(static::at(3)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->will(static::throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) ; // clean local clone if present $fs = new Filesystem(); $fs->removeDirectory(sys_get_temp_dir().'/composer-test'); - $process->expects($this->at(0)) + $process->expects(static::at(0)) ->method('execute') - ->with($this->equalTo('git config github.accesstoken')) - ->will($this->returnValue(1)) + ->with(static::equalTo('git config github.accesstoken')) + ->willReturn(1) ; - $process->expects($this->at(1)) + $process->expects(static::at(1)) ->method('execute') - ->with($this->stringContains($repoSshUrl)) - ->will($this->returnValue(0)) + ->with(static::stringContains($repoSshUrl)) + ->willReturn(0) ; - $process->expects($this->at(2)) + $process->expects(static::at(2)) ->method('execute') - ->with($this->stringContains('git show-ref --tags')) + ->with(static::stringContains('git show-ref --tags')) ; - $process->expects($this->at(3)) + $process->expects(static::at(3)) ->method('splitLines') - ->will($this->returnValue(array($sha.' refs/tags/'.$identifier))) + ->willReturn(array($sha.' refs/tags/'.$identifier)) ; - $process->expects($this->at(4)) + $process->expects(static::at(4)) ->method('execute') - ->with($this->stringContains('git branch --no-color --no-abbrev -v')) + ->with(static::stringContains('git branch --no-color --no-abbrev -v')) ; - $process->expects($this->at(5)) + $process->expects(static::at(5)) ->method('splitLines') - ->will($this->returnValue(array(' test_master edf93f1fccaebd8764383dc12016d0a1a9672d89 Fix test & behavior'))) + ->willReturn(array(' test_master edf93f1fccaebd8764383dc12016d0a1a9672d89 Fix test & behavior')) ; - $process->expects($this->at(6)) + $process->expects(static::at(6)) ->method('execute') - ->with($this->stringContains('git branch --no-color')) + ->with(static::stringContains('git branch --no-color')) ; - $process->expects($this->at(7)) + $process->expects(static::at(7)) ->method('splitLines') - ->will($this->returnValue(array('* test_master'))) + ->willReturn(array('* test_master')) ; $repoConfig = array( @@ -437,22 +437,22 @@ public function testPrivateRepositoryNoInteraction($type, $filename) $gitHubDriver = new GitHubDriver($repoConfig, $io, $this->config, $process, $remoteFilesystem); $gitHubDriver->initialize(); - $this->assertEquals('test_master', $gitHubDriver->getRootIdentifier()); + static::assertEquals('test_master', $gitHubDriver->getRootIdentifier()); $dist = $gitHubDriver->getDist($sha); - $this->assertEquals('zip', $dist['type']); - $this->assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); - $this->assertEquals($sha, $dist['reference']); + static::assertEquals('zip', $dist['type']); + static::assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); + static::assertEquals($sha, $dist['reference']); $source = $gitHubDriver->getSource($identifier); - $this->assertEquals('git', $source['type']); - $this->assertEquals($repoSshUrl, $source['url']); - $this->assertEquals($identifier, $source['reference']); + static::assertEquals('git', $source['type']); + static::assertEquals($repoSshUrl, $source['url']); + static::assertEquals($identifier, $source['reference']); $source = $gitHubDriver->getSource($sha); - $this->assertEquals('git', $source['type']); - $this->assertEquals($repoSshUrl, $source['url']); - $this->assertEquals($sha, $source['reference']); + static::assertEquals('git', $source['type']); + static::assertEquals($repoSshUrl, $source['url']); + static::assertEquals($sha, $source['reference']); } /** @@ -467,9 +467,9 @@ public function testGetComposerInformationWithGitDriver($type, $filename) $identifier = 'v0.0.0'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $repoConfig = array( @@ -481,15 +481,15 @@ public function testGetComposerInformationWithGitDriver($type, $filename) ); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function () { + ->willReturnCallback(function () { return 0; - })) + }) ; /** @var IOInterface $io */ @@ -501,7 +501,7 @@ public function testGetComposerInformationWithGitDriver($type, $filename) '_nonexistent_package' => true, ); - $this->assertSame($validEmpty, $gitHubDriver->getComposerInformation($identifier)); + static::assertSame($validEmpty, $gitHubDriver->getComposerInformation($identifier)); } /** @@ -519,9 +519,9 @@ public function testGetComposerInformationWithCodeCache($type, $filename) $sha = '92bebbfdcde75ef2368317830e54b605bc938123'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; /** @var IOInterface $io */ @@ -543,7 +543,7 @@ public function testGetComposerInformationWithCodeCache($type, $filename) $composer1 = $gitHubDriver->getComposerInformation($sha); $composer2 = $gitHubDriver->getComposerInformation($sha); - $this->assertSame($composer1, $composer2); + static::assertSame($composer1, $composer2); } /** @@ -561,9 +561,9 @@ public function testGetComposerInformationWithFilesystemCache($type, $filename) $sha = '92bebbfdcde75ef2368317830e54b605bc938123'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; /** @var IOInterface $io */ @@ -591,7 +591,7 @@ public function testGetComposerInformationWithFilesystemCache($type, $filename) $composer1 = $gitHubDriver1->getComposerInformation($sha); $composer2 = $gitHubDriver2->getComposerInformation($sha); - $this->assertSame($composer1, $composer2); + static::assertSame($composer1, $composer2); } /** @@ -614,21 +614,21 @@ public function testGetComposerInformationWithEmptyContent($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->returnValue($this->createJsonComposer(array('master_branch' => 'test_master')))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->willReturn($this->createJsonComposer(array('master_branch' => 'test_master'))) ; - $remoteFilesystem->expects($this->at(1)) + $remoteFilesystem->expects(static::at(1)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$identifier), $this->equalTo(false)) - ->will($this->throwException(new TransportException('Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$identifier), static::equalTo(false)) + ->will(static::throwException(new TransportException('Not Found', 404))) ; - $remoteFilesystem->expects($this->at(2)) + $remoteFilesystem->expects(static::at(2)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$identifier), $this->equalTo(false)) - ->will($this->throwException(new TransportException('Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$identifier), static::equalTo(false)) + ->will(static::throwException(new TransportException('Not Found', 404))) ; $repoConfig = array( @@ -648,7 +648,7 @@ public function testGetComposerInformationWithEmptyContent($type, $filename) '_nonexistent_package' => true, ); - $this->assertSame($validEmpty, $gitHubDriver->getComposerInformation($identifier)); + static::assertSame($validEmpty, $gitHubDriver->getComposerInformation($identifier)); } /** @@ -673,16 +673,16 @@ public function testGetComposerInformationWithRuntimeException($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->returnValue($this->createJsonComposer(array('master_branch' => 'test_master')))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->willReturn($this->createJsonComposer(array('master_branch' => 'test_master'))) ; - $remoteFilesystem->expects($this->at(1)) + $remoteFilesystem->expects(static::at(1)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$identifier), $this->equalTo(false)) - ->will($this->returnValue('{"encoding":"base64","content":""}')) + ->with(static::equalTo('github.com'), static::equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$identifier), static::equalTo(false)) + ->willReturn('{"encoding":"base64","content":""}') ; $repoConfig = array( @@ -723,22 +723,22 @@ public function testGetComposerInformationWithTransportException($type, $filenam ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->returnValue($this->createJsonComposer(array('master_branch' => 'test_master')))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->willReturn($this->createJsonComposer(array('master_branch' => 'test_master'))) ; - $remoteFilesystem->expects($this->at(1)) + $remoteFilesystem->expects(static::at(1)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$identifier), $this->equalTo(false)) - ->will($this->throwException(new TransportException('Mock exception code 404', 404))) + ->with(static::equalTo('github.com'), static::equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$identifier), static::equalTo(false)) + ->will(static::throwException(new TransportException('Mock exception code 404', 404))) ; - $remoteFilesystem->expects($this->at(2)) + $remoteFilesystem->expects(static::at(2)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$identifier), $this->equalTo(false)) - ->will($this->throwException(new TransportException('Mock exception code 400', 400))) + ->with(static::equalTo('github.com'), static::equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$identifier), static::equalTo(false)) + ->will(static::throwException(new TransportException('Mock exception code 400', 400))) ; $repoConfig = array( @@ -772,9 +772,9 @@ public function testRedirectUrlRepository($type, $filename) $sha = 'SOMESHA'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $remoteFilesystem = $this->getMockBuilder('Composer\Util\RemoteFilesystem') @@ -782,31 +782,31 @@ public function testRedirectUrlRepository($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->will(static::throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) ; - $remoteFilesystem->expects($this->at(1)) + $remoteFilesystem->expects(static::at(1)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://github.com/composer-test/repo-name'), $this->equalTo(false)) - ->will($this->returnValue('')) + ->with(static::equalTo('github.com'), static::equalTo('https://github.com/composer-test/repo-name'), static::equalTo(false)) + ->willReturn('') ; - $remoteFilesystem->expects($this->at(2)) + $remoteFilesystem->expects(static::at(2)) ->method('getLastHeaders') - ->will($this->returnValue(array( + ->willReturn(array( 'HTTP/1.1 301 Moved Permanently', 'Header-parameter: test', 'Location: '.$repoUrl.'-new', - ))) + )) ; - $remoteFilesystem->expects($this->at(3)) + $remoteFilesystem->expects(static::at(3)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl.'-new'), $this->equalTo(false)) - ->will($this->returnValue($this->createJsonComposer(array('master_branch' => 'test_master')))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl.'-new'), static::equalTo(false)) + ->willReturn($this->createJsonComposer(array('master_branch' => 'test_master'))) ; $repoConfig = array( @@ -824,17 +824,17 @@ public function testRedirectUrlRepository($type, $filename) $gitHubDriver->initialize(); $this->setAttribute($gitHubDriver, 'tags', array($identifier => $sha)); - $this->assertEquals('test_master', $gitHubDriver->getRootIdentifier()); + static::assertEquals('test_master', $gitHubDriver->getRootIdentifier()); $dist = $gitHubDriver->getDist($sha); - $this->assertEquals('zip', $dist['type']); - $this->assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); - $this->assertEquals($sha, $dist['reference']); + static::assertEquals('zip', $dist['type']); + static::assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); + static::assertEquals($sha, $dist['reference']); $source = $gitHubDriver->getSource($sha); - $this->assertEquals('git', $source['type']); - $this->assertEquals($repoUrl, $source['url']); - $this->assertEquals($sha, $source['reference']); + static::assertEquals('git', $source['type']); + static::assertEquals($repoUrl, $source['url']); + static::assertEquals($sha, $source['reference']); } /** @@ -853,9 +853,9 @@ public function testRedirectUrlWithNonexistentRepository($type, $filename) $identifier = 'v0.0.0'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $remoteFilesystem = $this->getMockBuilder('Composer\Util\RemoteFilesystem') @@ -863,51 +863,51 @@ public function testRedirectUrlWithNonexistentRepository($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->will(static::throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) ; - $io->expects($this->once()) + $io->expects(static::once()) ->method('askAndHideAnswer') - ->with($this->equalTo('Token (hidden): ')) - ->will($this->returnValue('sometoken')) + ->with(static::equalTo('Token (hidden): ')) + ->willReturn('sometoken') ; - $io->expects($this->any()) + $io->expects(static::any()) ->method('setAuthentication') - ->with($this->equalTo('github.com'), $this->matchesRegularExpression('{sometoken|abcdef}'), $this->matchesRegularExpression('{x-oauth-basic}')) + ->with(static::equalTo('github.com'), static::matchesRegularExpression('{sometoken|abcdef}'), static::matchesRegularExpression('{x-oauth-basic}')) ; - $remoteFilesystem->expects($this->at(1)) + $remoteFilesystem->expects(static::at(1)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://github.com/composer-test/repo-name'), $this->equalTo(false)) - ->will($this->throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo('https://github.com/composer-test/repo-name'), static::equalTo(false)) + ->will(static::throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) ; - $remoteFilesystem->expects($this->at(2)) + $remoteFilesystem->expects(static::at(2)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->will(static::throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) ; - $remoteFilesystem->expects($this->at(3)) + $remoteFilesystem->expects(static::at(3)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/'), $this->equalTo(false)) - ->will($this->returnValue('{}')) + ->with(static::equalTo('github.com'), static::equalTo('https://api.github.com/'), static::equalTo(false)) + ->willReturn('{}') ; - $remoteFilesystem->expects($this->at(4)) + $remoteFilesystem->expects(static::at(4)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->will(static::throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) ; - $remoteFilesystem->expects($this->at(5)) + $remoteFilesystem->expects(static::at(5)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl.'/contents/'.$filename.'?ref='.$identifier), $this->equalTo(false)) - ->will($this->throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl.'/contents/'.$filename.'?ref='.$identifier), static::equalTo(false)) + ->will(static::throwException(new TransportException('HTTP/1.1 404 Not Found', 404))) ; $configSource = $this->getMockBuilder('Composer\Config\ConfigSourceInterface')->getMock(); @@ -938,7 +938,7 @@ public function testRedirectUrlWithNonexistentRepository($type, $filename) $firstNonexistent = true; } - $this->assertTrue($firstNonexistent); + static::assertTrue($firstNonexistent); $gitHubDriver->getComposerInformation($identifier); } @@ -962,9 +962,9 @@ public function testRedirectUrlRepositoryWithCache($type, $filename) $sha = 'SOMESHA'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $remoteFilesystem = $this->getMockBuilder('Composer\Util\RemoteFilesystem') @@ -972,10 +972,10 @@ public function testRedirectUrlRepositoryWithCache($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrlNew), $this->equalTo(false)) - ->will($this->returnValue($this->createJsonComposer(array('master_branch' => 'test_master')))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrlNew), static::equalTo(false)) + ->willReturn($this->createJsonComposer(array('master_branch' => 'test_master'))) ; $repoConfig = array( @@ -996,17 +996,17 @@ public function testRedirectUrlRepositoryWithCache($type, $filename) $gitHubDriver->initialize(); $this->setAttribute($gitHubDriver, 'tags', array($identifier => $sha)); - $this->assertEquals('test_master', $gitHubDriver->getRootIdentifier()); + static::assertEquals('test_master', $gitHubDriver->getRootIdentifier()); $dist = $gitHubDriver->getDist($sha); - $this->assertEquals('zip', $dist['type']); - $this->assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); - $this->assertEquals($sha, $dist['reference']); + static::assertEquals('zip', $dist['type']); + static::assertEquals('https://api.github.com/repos/composer-test/repo-name/zipball/SOMESHA', $dist['url']); + static::assertEquals($sha, $dist['reference']); $source = $gitHubDriver->getSource($sha); - $this->assertEquals('git', $source['type']); - $this->assertEquals($repoUrl, $source['url']); - $this->assertEquals($sha, $source['reference']); + static::assertEquals('git', $source['type']); + static::assertEquals($repoUrl, $source['url']); + static::assertEquals($sha, $source['reference']); } public function getDataBranches() @@ -1059,9 +1059,9 @@ public function testGetBranchesWithGitDriver($type, $filename, array $branches, $repoUrl = 'https://github.com/composer-test/repo-name'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $repoConfig = array( @@ -1073,15 +1073,15 @@ public function testGetBranchesWithGitDriver($type, $filename, array $branches, ); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue($gitBranches)) + ->willReturn($gitBranches) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function () { + ->willReturnCallback(function () { return 0; - })) + }) ; /** @var IOInterface $io */ @@ -1089,7 +1089,7 @@ public function testGetBranchesWithGitDriver($type, $filename, array $branches, $gitHubDriver = new GitHubDriver($repoConfig, $io, $this->config, $process, null); $gitHubDriver->initialize(); - $this->assertSame($branches, $gitHubDriver->getBranches()); + static::assertSame($branches, $gitHubDriver->getBranches()); } /** @@ -1108,9 +1108,9 @@ public function testGetBranches($type, $filename, array $branches) $sha = 'SOMESHA'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $remoteFilesystem = $this->getMockBuilder('Composer\Util\RemoteFilesystem') @@ -1118,15 +1118,15 @@ public function testGetBranches($type, $filename, array $branches) ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->returnValue($this->createJsonComposer(array('master_branch' => 'gh-pages')))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->willReturn($this->createJsonComposer(array('master_branch' => 'gh-pages'))) ; - $remoteFilesystem->expects($this->any()) + $remoteFilesystem->expects(static::any()) ->method('getLastHeaders') - ->will($this->returnValue(array())) + ->willReturn(array()) ; $githubBranches = array(); @@ -1139,9 +1139,9 @@ public function testGetBranches($type, $filename, array $branches) ); } - $remoteFilesystem->expects($this->at(1)) + $remoteFilesystem->expects(static::at(1)) ->method('getContents') - ->will($this->returnValue(json_encode($githubBranches))) + ->willReturn(json_encode($githubBranches)) ; $repoConfig = array( @@ -1158,8 +1158,8 @@ public function testGetBranches($type, $filename, array $branches) $gitHubDriver->initialize(); $this->setAttribute($gitHubDriver, 'tags', array($identifier => $sha)); - $this->assertEquals('gh-pages', $gitHubDriver->getRootIdentifier()); - $this->assertSame($branches, $gitHubDriver->getBranches()); + static::assertEquals('gh-pages', $gitHubDriver->getRootIdentifier()); + static::assertSame($branches, $gitHubDriver->getBranches()); } /** @@ -1176,9 +1176,9 @@ public function testNoApi($type, $filename, array $branches, array $gitBranches) $packageName = $type.'-asset/repo-name'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $repoConfig = array( @@ -1193,15 +1193,15 @@ public function testNoApi($type, $filename, array $branches, array $gitBranches) ); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue($gitBranches)) + ->willReturn($gitBranches) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function () { + ->willReturnCallback(function () { return 0; - })) + }) ; /** @var IOInterface $io */ @@ -1209,7 +1209,7 @@ public function testNoApi($type, $filename, array $branches, array $gitBranches) $gitHubDriver = new GitHubDriver($repoConfig, $io, $this->config, $process, null); $gitHubDriver->initialize(); - $this->assertSame($branches, $gitHubDriver->getBranches()); + static::assertSame($branches, $gitHubDriver->getBranches()); } /** @@ -1259,26 +1259,26 @@ protected function createMockRremoteFilesystem($io, $repoApiUrl, $filename, $sha ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo($repoApiUrl), $this->equalTo(false)) - ->will($this->returnValue($this->createJsonComposer(array('master_branch' => 'test_master')))) + ->with(static::equalTo('github.com'), static::equalTo($repoApiUrl), static::equalTo(false)) + ->willReturn($this->createJsonComposer(array('master_branch' => 'test_master'))) ; if ($forCache) { return $remoteFilesystem; } - $remoteFilesystem->expects($this->at(1)) + $remoteFilesystem->expects(static::at(1)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$sha), $this->equalTo(false)) - ->will($this->returnValue('{"encoding":"base64","content":"'.base64_encode('{"support": {}}').'"}')) + ->with(static::equalTo('github.com'), static::equalTo('https://api.github.com/repos/composer-test/repo-name/contents/'.$filename.'?ref='.$sha), static::equalTo(false)) + ->willReturn('{"encoding":"base64","content":"'.base64_encode('{"support": {}}').'"}') ; - $remoteFilesystem->expects($this->at(2)) + $remoteFilesystem->expects(static::at(2)) ->method('getContents') - ->with($this->equalTo('github.com'), $this->equalTo('https://api.github.com/repos/composer-test/repo-name/commits/'.$sha), $this->equalTo(false)) - ->will($this->returnValue('{"commit": {"committer":{ "date": "2012-09-10"}}}')) + ->with(static::equalTo('github.com'), static::equalTo('https://api.github.com/repos/composer-test/repo-name/commits/'.$sha), static::equalTo(false)) + ->willReturn('{"commit": {"committer":{ "date": "2012-09-10"}}}') ; return $remoteFilesystem; diff --git a/Tests/Repository/Vcs/HgBitbucketDriverTest.php b/Tests/Repository/Vcs/HgBitbucketDriverTest.php index 42caecc6..64baeb1e 100644 --- a/Tests/Repository/Vcs/HgBitbucketDriverTest.php +++ b/Tests/Repository/Vcs/HgBitbucketDriverTest.php @@ -72,9 +72,9 @@ public function testPublicRepositoryWithComposer($type, $filename) $sha = 'SOMESHA'; $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $io->expects($this->any()) + $io->expects(static::any()) ->method('isInteractive') - ->will($this->returnValue(true)) + ->willReturn(true) ; $remoteFilesystem = $this->getMockBuilder('Composer\Util\RemoteFilesystem') @@ -82,7 +82,7 @@ public function testPublicRepositoryWithComposer($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->any()) + $remoteFilesystem->expects(static::any()) ->method('getContents') ->withConsecutive( array( @@ -127,17 +127,17 @@ public function testPublicRepositoryWithComposer($type, $filename) '^1.7.0' => 'default', '1.6.*' => 'test_master', )); - $this->assertEquals($expectedRootIdentifier, $driver->getRootIdentifier()); + static::assertEquals($expectedRootIdentifier, $driver->getRootIdentifier()); $dist = $driver->getDist($sha); - $this->assertEquals('zip', $dist['type']); - $this->assertEquals($this->getScheme($repoUrl).'/get/SOMESHA.zip', $dist['url']); - $this->assertEquals($sha, $dist['reference']); + static::assertEquals('zip', $dist['type']); + static::assertEquals($this->getScheme($repoUrl).'/get/SOMESHA.zip', $dist['url']); + static::assertEquals($sha, $dist['reference']); $source = $driver->getSource($sha); - $this->assertEquals('hg', $source['type']); - $this->assertEquals($repoUrl, $source['url']); - $this->assertEquals($sha, $source['reference']); + static::assertEquals('hg', $source['type']); + static::assertEquals($repoUrl, $source['url']); + static::assertEquals($sha, $source['reference']); $driver->getComposerInformation($identifier); } @@ -159,10 +159,10 @@ public function testPublicRepositoryWithEmptyComposer($type, $filename) ->getMock() ; - $remoteFilesystem->expects($this->at(0)) + $remoteFilesystem->expects(static::at(0)) ->method('getContents') - ->with($this->equalTo('bitbucket.org'), $this->equalTo($this->getScheme($repoUrl).'/raw/'.$identifier.'/'.$filename), $this->equalTo(false)) - ->will($this->throwException(new TransportException('Not Found', 404))) + ->with(static::equalTo('bitbucket.org'), static::equalTo($this->getScheme($repoUrl).'/raw/'.$identifier.'/'.$filename), static::equalTo(false)) + ->will(static::throwException(new TransportException('Not Found', 404))) ; $repoConfig = array( @@ -180,7 +180,7 @@ public function testPublicRepositoryWithEmptyComposer($type, $filename) '_nonexistent_package' => true, ); - $this->assertSame($validEmpty, $driver->getComposerInformation($identifier)); + static::assertSame($validEmpty, $driver->getComposerInformation($identifier)); } /** diff --git a/Tests/Repository/Vcs/HgDriverTest.php b/Tests/Repository/Vcs/HgDriverTest.php index a6059cd3..316f97d8 100644 --- a/Tests/Repository/Vcs/HgDriverTest.php +++ b/Tests/Repository/Vcs/HgDriverTest.php @@ -76,15 +76,15 @@ public function testPublicRepositoryWithEmptyComposer($type, $filename) ); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function () { + ->willReturnCallback(function () { return 0; - })) + }) ; /** @var IOInterface $io */ @@ -96,7 +96,7 @@ public function testPublicRepositoryWithEmptyComposer($type, $filename) '_nonexistent_package' => true, ); - $this->assertSame($validEmpty, $driver->getComposerInformation($identifier)); + static::assertSame($validEmpty, $driver->getComposerInformation($identifier)); } /** @@ -116,13 +116,13 @@ public function testPublicRepositoryWithCodeCache($type, $filename) ); $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function ($command, &$output = null) use ($identifier, $repoConfig) { + ->willReturnCallback(function ($command, &$output = null) use ($identifier, $repoConfig) { if ($command === sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), $repoConfig['filename'])) { $output = '{"name": "foo"}'; } elseif (false !== strpos($command, 'hg log')) { @@ -131,7 +131,7 @@ public function testPublicRepositoryWithCodeCache($type, $filename) } return 0; - })) + }) ; /** @var IOInterface $io */ @@ -141,9 +141,9 @@ public function testPublicRepositoryWithCodeCache($type, $filename) $composer1 = $driver->getComposerInformation($identifier); $composer2 = $driver->getComposerInformation($identifier); - $this->assertNotNull($composer1); - $this->assertNotNull($composer2); - $this->assertSame($composer1, $composer2); + static::assertNotNull($composer1); + static::assertNotNull($composer2); + static::assertSame($composer1, $composer2); } /** @@ -163,13 +163,13 @@ public function testPublicRepositoryWithFilesystemCache($type, $filename) ); $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function ($command, &$output = null) use ($identifier, $repoConfig) { + ->willReturnCallback(function ($command, &$output = null) use ($identifier, $repoConfig) { if ($command === sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), $repoConfig['filename'])) { $output = '{"name": "foo"}'; } elseif (false !== strpos($command, 'hg log')) { @@ -178,7 +178,7 @@ public function testPublicRepositoryWithFilesystemCache($type, $filename) } return 0; - })) + }) ; /** @var IOInterface $io */ @@ -190,9 +190,9 @@ public function testPublicRepositoryWithFilesystemCache($type, $filename) $composer1 = $driver1->getComposerInformation($identifier); $composer2 = $driver2->getComposerInformation($identifier); - $this->assertNotNull($composer1); - $this->assertNotNull($composer2); - $this->assertSame($composer1, $composer2); + static::assertNotNull($composer1); + static::assertNotNull($composer2); + static::assertSame($composer1, $composer2); } /** diff --git a/Tests/Repository/Vcs/PerforceDriverTest.php b/Tests/Repository/Vcs/PerforceDriverTest.php index 6a307be5..a6864e0f 100644 --- a/Tests/Repository/Vcs/PerforceDriverTest.php +++ b/Tests/Repository/Vcs/PerforceDriverTest.php @@ -79,9 +79,9 @@ public function testInitializeCapturesVariablesFromRepoConfig() { $driver = new PerforceDriver($this->repoConfig, $this->io, $this->config, $this->process, $this->remoteFileSystem); $driver->initialize(); - $this->assertEquals(self::TEST_URL, $driver->getUrl()); - $this->assertEquals(self::TEST_DEPOT, $driver->getDepot()); - $this->assertEquals(self::TEST_BRANCH, $driver->getBranch()); + static::assertEquals(self::TEST_URL, $driver->getUrl()); + static::assertEquals(self::TEST_DEPOT, $driver->getDepot()); + static::assertEquals(self::TEST_BRANCH, $driver->getBranch()); } /** @@ -92,25 +92,25 @@ public function testInitializeCapturesVariablesFromRepoConfig() public function testSupportsReturnsFalseNoDeepCheck() { $this->expectOutputString(''); - $this->assertFalse(PerforceDriver::supports($this->io, $this->config, 'existing.url')); + static::assertFalse(PerforceDriver::supports($this->io, $this->config, 'existing.url')); } public function testInitializeLogsInAndConnectsClient() { - $this->perforce->expects($this->at(0))->method('p4Login'); - $this->perforce->expects($this->at(1))->method('checkStream'); - $this->perforce->expects($this->at(2))->method('writeP4ClientSpec'); - $this->perforce->expects($this->at(3))->method('connectClient'); + $this->perforce->expects(static::at(0))->method('p4Login'); + $this->perforce->expects(static::at(1))->method('checkStream'); + $this->perforce->expects(static::at(2))->method('writeP4ClientSpec'); + $this->perforce->expects(static::at(3))->method('connectClient'); $this->driver->initialize(); } public function testPublicRepositoryWithEmptyComposer() { $identifier = 'TEST_IDENTIFIER'; - $this->perforce->expects($this->any()) + $this->perforce->expects(static::any()) ->method('getComposerInformation') - ->with($this->equalTo($identifier)) - ->will($this->returnValue('')) + ->with(static::equalTo($identifier)) + ->willReturn('') ; $this->driver->initialize(); @@ -118,34 +118,34 @@ public function testPublicRepositoryWithEmptyComposer() '_nonexistent_package' => true, ); - $this->assertSame($validEmpty, $this->driver->getComposerInformation($identifier)); + static::assertSame($validEmpty, $this->driver->getComposerInformation($identifier)); } public function testPublicRepositoryWithCodeCache() { $identifier = 'TEST_IDENTIFIER'; - $this->perforce->expects($this->any()) + $this->perforce->expects(static::any()) ->method('getComposerInformation') - ->with($this->equalTo($identifier)) - ->will($this->returnValue(array('name' => 'foo'))) + ->with(static::equalTo($identifier)) + ->willReturn(array('name' => 'foo')) ; $this->driver->initialize(); $composer1 = $this->driver->getComposerInformation($identifier); $composer2 = $this->driver->getComposerInformation($identifier); - $this->assertNotNull($composer1); - $this->assertNotNull($composer2); - $this->assertSame($composer1, $composer2); + static::assertNotNull($composer1); + static::assertNotNull($composer2); + static::assertSame($composer1, $composer2); } public function testPublicRepositoryWithFilesystemCache() { $identifier = 'TEST_IDENTIFIER'; - $this->perforce->expects($this->any()) + $this->perforce->expects(static::any()) ->method('getComposerInformation') - ->with($this->equalTo($identifier)) - ->will($this->returnValue(array('name' => 'foo'))) + ->with(static::equalTo($identifier)) + ->willReturn(array('name' => 'foo')) ; $driver2 = new PerforceDriver($this->repoConfig, $this->io, $this->config, $this->process, $this->remoteFileSystem); @@ -160,9 +160,9 @@ public function testPublicRepositoryWithFilesystemCache() $composer1 = $this->driver->getComposerInformation($identifier); $composer2 = $driver2->getComposerInformation($identifier); - $this->assertNotNull($composer1); - $this->assertNotNull($composer2); - $this->assertSame($composer1, $composer2); + static::assertNotNull($composer1); + static::assertNotNull($composer2); + static::assertSame($composer1, $composer2); } protected function getMockIOInterface() diff --git a/Tests/Repository/Vcs/SvnDriverTest.php b/Tests/Repository/Vcs/SvnDriverTest.php index 4a8d9f04..103eb692 100644 --- a/Tests/Repository/Vcs/SvnDriverTest.php +++ b/Tests/Repository/Vcs/SvnDriverTest.php @@ -79,15 +79,15 @@ public function testPublicRepositoryWithEmptyComposer($type, $filename, $identif ); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function () { + ->willReturnCallback(function () { return 0; - })) + }) ; /** @var IOInterface $io */ @@ -99,7 +99,7 @@ public function testPublicRepositoryWithEmptyComposer($type, $filename, $identif '_nonexistent_package' => true, ); - $this->assertSame($validEmpty, $driver->getComposerInformation($identifier)); + static::assertSame($validEmpty, $driver->getComposerInformation($identifier)); } /** @@ -133,15 +133,15 @@ public function testPrivateRepositoryWithEmptyComposer($type, $filename, $identi ); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function () { + ->willReturnCallback(function () { return 0; - })) + }) ; /** @var IOInterface $io */ @@ -153,7 +153,7 @@ public function testPrivateRepositoryWithEmptyComposer($type, $filename, $identi '_nonexistent_package' => true, ); - $this->assertSame($validEmpty, $driver->getComposerInformation($identifier)); + static::assertSame($validEmpty, $driver->getComposerInformation($identifier)); } /** @@ -174,15 +174,15 @@ public function testPublicRepositoryWithCodeCache($type, $filename, $identifier) ); $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnCallback(function ($value) { + ->willReturnCallback(function ($value) { return \is_string($value) ? preg_split('{\r?\n}', $value) : array(); - })) + }) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function ($command, &$output) use ($repoBaseUrl, $identifier, $repoConfig) { + ->willReturnCallback(function ($command, &$output) use ($repoBaseUrl, $identifier, $repoConfig) { if ($command === sprintf('svn cat --non-interactive %s', ProcessExecutor::escape(sprintf('%s/%s/%s', $repoBaseUrl, $identifier, $repoConfig['filename']))) || $command === sprintf('svn cat --non-interactive %s', ProcessExecutor::escape(sprintf('%s/%s%s', $repoBaseUrl, $repoConfig['filename'], trim($identifier, '/'))))) { $output('out', '{"name": "foo"}'); @@ -198,7 +198,7 @@ public function testPublicRepositoryWithCodeCache($type, $filename, $identifier) } return 0; - })) + }) ; /** @var IOInterface $io */ @@ -208,10 +208,10 @@ public function testPublicRepositoryWithCodeCache($type, $filename, $identifier) $composer1 = $driver->getComposerInformation($identifier); $composer2 = $driver->getComposerInformation($identifier); - $this->assertNotNull($composer1); - $this->assertNotNull($composer2); - $this->assertSame($composer1, $composer2); - $this->assertArrayHasKey('time', $composer1); + static::assertNotNull($composer1); + static::assertNotNull($composer2); + static::assertSame($composer1, $composer2); + static::assertArrayHasKey('time', $composer1); } /** @@ -232,15 +232,15 @@ public function testPublicRepositoryWithFilesystemCache($type, $filename, $ident ); $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnCallback(function ($value) { + ->willReturnCallback(function ($value) { return \is_string($value) ? preg_split('{\r?\n}', $value) : array(); - })) + }) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function ($command, &$output) use ($repoBaseUrl, $identifier, $repoConfig) { + ->willReturnCallback(function ($command, &$output) use ($repoBaseUrl, $identifier, $repoConfig) { if ($command === sprintf('svn cat --non-interactive %s', ProcessExecutor::escape(sprintf('%s/%s/%s', $repoBaseUrl, $identifier, $repoConfig['filename']))) || $command === sprintf('svn cat --non-interactive %s', ProcessExecutor::escape(sprintf('%s/%s%s', $repoBaseUrl, $repoConfig['filename'], trim($identifier, '/'))))) { $output('out', '{"name": "foo"}'); @@ -256,7 +256,7 @@ public function testPublicRepositoryWithFilesystemCache($type, $filename, $ident } return 0; - })) + }) ; /** @var IOInterface $io */ @@ -268,10 +268,10 @@ public function testPublicRepositoryWithFilesystemCache($type, $filename, $ident $composer1 = $driver1->getComposerInformation($identifier); $composer2 = $driver2->getComposerInformation($identifier); - $this->assertNotNull($composer1); - $this->assertNotNull($composer2); - $this->assertSame($composer1, $composer2); - $this->assertArrayHasKey('time', $composer1); + static::assertNotNull($composer1); + static::assertNotNull($composer2); + static::assertSame($composer1, $composer2); + static::assertArrayHasKey('time', $composer1); } /** @@ -295,15 +295,15 @@ public function testPublicRepositoryWithInvalidUrl($type, $filename, $identifier ); $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('splitLines') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function ($command) { + ->willReturnCallback(function ($command) { return 0 === strpos($command, 'svn cat ') ? 1 : 0; - })) + }) ; /** @var IOInterface $io */ @@ -344,18 +344,18 @@ public function testSupports($url, $supperted, $urlUsed) /** @var IOInterface $io */ $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $this->assertSame($supperted, SvnDriver::supports($io, $this->config, $url, false)); + static::assertSame($supperted, SvnDriver::supports($io, $this->config, $url, false)); if (!$supperted) { return; } $process = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); - $process->expects($this->any()) + $process->expects(static::any()) ->method('execute') - ->will($this->returnCallback(function () { + ->willReturnCallback(function () { return 0; - })) + }) ; $repoConfig = array( @@ -369,6 +369,6 @@ public function testSupports($url, $supperted, $urlUsed) $driver = new SvnDriver($repoConfig, $io, $this->config, $process, null); $driver->initialize(); - $this->assertEquals($urlUsed, $driver->getUrl()); + static::assertEquals($urlUsed, $driver->getUrl()); } } diff --git a/Tests/Repository/Vcs/UtilTest.php b/Tests/Repository/Vcs/UtilTest.php index d3e22d72..021ed581 100644 --- a/Tests/Repository/Vcs/UtilTest.php +++ b/Tests/Repository/Vcs/UtilTest.php @@ -63,6 +63,6 @@ public function testAddComposerTimeWithSimpleKey($resourceKey) $composer = Util::addComposerTime($composer, $resourceKey, 'http://example.tld', $driver); - $this->assertSame($composerValid, $composer); + static::assertSame($composerValid, $composer); } } diff --git a/Tests/Repository/VcsPackageFilterTest.php b/Tests/Repository/VcsPackageFilterTest.php index 68132c83..555958b6 100644 --- a/Tests/Repository/VcsPackageFilterTest.php +++ b/Tests/Repository/VcsPackageFilterTest.php @@ -68,15 +68,15 @@ protected function setUp() $this->assetType = $this->getMockBuilder('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface')->getMock(); $versionConverter = $this->getMockBuilder('Fxp\Composer\AssetPlugin\Converter\VersionConverterInterface')->getMock(); - $versionConverter->expects($this->any()) + $versionConverter->expects(static::any()) ->method('convertVersion') - ->will($this->returnCallback(function ($value) { + ->willReturnCallback(function ($value) { return $value; - })) + }) ; - $this->assetType->expects($this->any()) + $this->assetType->expects(static::any()) ->method('getVersionConverter') - ->will($this->returnValue($versionConverter)) + ->willReturn($versionConverter) ; $this->installationManager = $this->getMockBuilder('Composer\Installer\InstallationManager') @@ -84,12 +84,12 @@ protected function setUp() ->getMock() ; - $this->installationManager->expects($this->any()) + $this->installationManager->expects(static::any()) ->method('isPackageInstalled') - ->will($this->returnValue(true)) + ->willReturn(true) ; - $this->composer->expects($this->any()) + $this->composer->expects(static::any()) ->method('getPackage') ->willReturn($this->package) ; @@ -474,7 +474,7 @@ public function testSkipVersion($packageName, $version, $minimumStability, array { $this->init($rootRequires, $minimumStability, $rootConfig); - $this->assertSame($validSkip, $this->filter->skip($this->assetType, $packageName, $version)); + static::assertSame($validSkip, $this->filter->skip($this->assetType, $packageName, $version)); } public function getDataProviderForDisableTest() @@ -504,7 +504,7 @@ public function testDisabledFilterWithInstalledPackage($packageName, $version, $ $this->init($rootRequires, $minimumStability); $this->filter->setEnabled(false); - $this->assertSame($validSkip, $this->filter->skip($this->assetType, $packageName, $version)); + static::assertSame($validSkip, $this->filter->skip($this->assetType, $packageName, $version)); } public function getDataForInstalledTests() @@ -600,14 +600,14 @@ public function testFilterWithInstalledPackage(array $config, $packageName, $ver ->getMock() ; - $this->installedRepository->expects($this->any()) + $this->installedRepository->expects(static::any()) ->method('getPackages') - ->will($this->returnValue($this->convertInstalled($installed))) + ->willReturn($this->convertInstalled($installed)) ; $this->init($require, $minimumStability, $config); - $this->assertSame($validSkip, $this->filter->skip($this->assetType, $packageName, $version)); + static::assertSame($validSkip, $this->filter->skip($this->assetType, $packageName, $version)); } /** @@ -624,27 +624,27 @@ protected function init(array $requires = array(), $minimumStability = 'stable', $stabilityFlags = $this->findStabilityFlags($requires); - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getRequires') - ->will($this->returnValue($linkRequires)) + ->willReturn($linkRequires) ; - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getDevRequires') - ->will($this->returnValue(array())) + ->willReturn(array()) ; - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getMinimumStability') - ->will($this->returnValue($minimumStability)) + ->willReturn($minimumStability) ; - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getStabilityFlags') - ->will($this->returnValue($stabilityFlags)) + ->willReturn($stabilityFlags) ; - $this->package->expects($this->any()) + $this->package->expects(static::any()) ->method('getConfig') - ->will($this->returnValue(array( + ->willReturn(array( 'fxp-asset' => $config, - ))) + )) ; /** @var RootPackageInterface $package */ @@ -669,19 +669,19 @@ protected function convertInstalled(array $installed) foreach ($installed as $name => $version) { $package = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); - $package->expects($this->any()) + $package->expects(static::any()) ->method('getName') - ->will($this->returnValue($name)) + ->willReturn($name) ; - $package->expects($this->any()) + $package->expects(static::any()) ->method('getVersion') - ->will($this->returnValue($parser->normalize($version))) + ->willReturn($parser->normalize($version)) ; - $package->expects($this->any()) + $package->expects(static::any()) ->method('getPrettyVersion') - ->will($this->returnValue($version)) + ->willReturn($version) ; $packages[] = $package; diff --git a/Tests/TestCase.php b/Tests/TestCase.php index 15786c3d..4a30beb5 100644 --- a/Tests/TestCase.php +++ b/Tests/TestCase.php @@ -105,7 +105,7 @@ protected function skipIfNotExecutable($executableName) } if (false === self::$executableCache[$executableName]) { - $this->markTestSkipped($executableName.' is not found or not executable.'); + static::markTestSkipped($executableName.' is not found or not executable.'); } } } diff --git a/Tests/Type/AbstractAssetTypeTest.php b/Tests/Type/AbstractAssetTypeTest.php index c1d0a414..7476b777 100644 --- a/Tests/Type/AbstractAssetTypeTest.php +++ b/Tests/Type/AbstractAssetTypeTest.php @@ -52,7 +52,7 @@ protected function tearDown() public function testConverter() { - $this->assertInstanceOf('Fxp\Composer\AssetPlugin\Converter\PackageConverterInterface', $this->type->getPackageConverter()); - $this->assertInstanceOf('Fxp\Composer\AssetPlugin\Converter\VersionConverterInterface', $this->type->getVersionConverter()); + static::assertInstanceOf('Fxp\Composer\AssetPlugin\Converter\PackageConverterInterface', $this->type->getPackageConverter()); + static::assertInstanceOf('Fxp\Composer\AssetPlugin\Converter\VersionConverterInterface', $this->type->getVersionConverter()); } } diff --git a/Tests/Type/BowerAssetTypeTest.php b/Tests/Type/BowerAssetTypeTest.php index 52aeb4c3..583c2352 100644 --- a/Tests/Type/BowerAssetTypeTest.php +++ b/Tests/Type/BowerAssetTypeTest.php @@ -31,11 +31,11 @@ protected function setUp() public function testInformations() { - $this->assertSame('bower', $this->type->getName()); - $this->assertSame('bower-asset', $this->type->getComposerVendorName()); - $this->assertSame('bower-asset-library', $this->type->getComposerType()); - $this->assertSame('bower.json', $this->type->getFilename()); - $this->assertSame('bower-asset/foobar', $this->type->formatComposerName('foobar')); - $this->assertSame('bower-asset/foobar', $this->type->formatComposerName('bower-asset/foobar')); + static::assertSame('bower', $this->type->getName()); + static::assertSame('bower-asset', $this->type->getComposerVendorName()); + static::assertSame('bower-asset-library', $this->type->getComposerType()); + static::assertSame('bower.json', $this->type->getFilename()); + static::assertSame('bower-asset/foobar', $this->type->formatComposerName('foobar')); + static::assertSame('bower-asset/foobar', $this->type->formatComposerName('bower-asset/foobar')); } } diff --git a/Tests/Type/NpmAssetTypeTest.php b/Tests/Type/NpmAssetTypeTest.php index 82d39363..f835515a 100644 --- a/Tests/Type/NpmAssetTypeTest.php +++ b/Tests/Type/NpmAssetTypeTest.php @@ -31,11 +31,11 @@ protected function setUp() public function testInformations() { - $this->assertSame('npm', $this->type->getName()); - $this->assertSame('npm-asset', $this->type->getComposerVendorName()); - $this->assertSame('npm-asset-library', $this->type->getComposerType()); - $this->assertSame('package.json', $this->type->getFilename()); - $this->assertSame('npm-asset/foobar', $this->type->formatComposerName('foobar')); - $this->assertSame('npm-asset/foobar', $this->type->formatComposerName('npm-asset/foobar')); + static::assertSame('npm', $this->type->getName()); + static::assertSame('npm-asset', $this->type->getComposerVendorName()); + static::assertSame('npm-asset-library', $this->type->getComposerType()); + static::assertSame('package.json', $this->type->getFilename()); + static::assertSame('npm-asset/foobar', $this->type->formatComposerName('foobar')); + static::assertSame('npm-asset/foobar', $this->type->formatComposerName('npm-asset/foobar')); } } diff --git a/Tests/Util/PerforceTest.php b/Tests/Util/PerforceTest.php index 2cb7e058..92961fe3 100644 --- a/Tests/Util/PerforceTest.php +++ b/Tests/Util/PerforceTest.php @@ -107,7 +107,7 @@ public function testQueryP4PasswordWithPasswordAlreadySet() ); $this->perforce = new Perforce($repoConfig, 'port', 'path', $this->processExecutor, false, $this->getMockIOInterface()); $password = $this->perforce->queryP4Password(); - $this->assertEquals('TEST_PASSWORD', $password); + static::assertEquals('TEST_PASSWORD', $password); } public function getTestRepoConfig() @@ -127,17 +127,15 @@ public function testGetComposerInformationWithoutLabelWithoutStream() '^1.7.0' => 'p4 -u user -c composer_perforce_TEST_depot -p port print '.escapeshellarg('//depot/ASSET.json'), '1.6.*' => 'p4 -u user -c composer_perforce_TEST_depot -p port print //depot/ASSET.json', )); - $this->processExecutor->expects($this->at(0)) + $this->processExecutor->expects(static::at(0)) ->method('execute') - ->with($this->equalTo($expectedCommand)) - ->will( - $this->returnCallback( - function ($command, &$output) { - $output = PerforceTest::getComposerJson(); - - return $command ? true : true; - } - ) + ->with(static::equalTo($expectedCommand)) + ->willReturnCallback( + function ($command, &$output) { + $output = PerforceTest::getComposerJson(); + + return $command ? true : true; + } ) ; @@ -148,7 +146,7 @@ function ($command, &$output) { 'minimum-stability' => 'dev', 'autoload' => array('psr-0' => array()), ); - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } public function testGetComposerInformationWithLabelWithoutStream() @@ -157,17 +155,15 @@ public function testGetComposerInformationWithLabelWithoutStream() '^1.7.0' => 'p4 -u user -p port files '.escapeshellarg('//depot/ASSET.json@0.0.1'), '1.6.*' => 'p4 -u user -p port files //depot/ASSET.json@0.0.1', )); - $this->processExecutor->expects($this->at(0)) + $this->processExecutor->expects(static::at(0)) ->method('execute') - ->with($this->equalTo($expectedCommand)) - ->will( - $this->returnCallback( - function ($command, &$output) { - $output = '//depot/ASSET.json#1 - branch change 10001 (text)'; - - return $command ? true : true; - } - ) + ->with(static::equalTo($expectedCommand)) + ->willReturnCallback( + function ($command, &$output) { + $output = '//depot/ASSET.json#1 - branch change 10001 (text)'; + + return $command ? true : true; + } ) ; @@ -175,17 +171,15 @@ function ($command, &$output) { '^1.7.0' => 'p4 -u user -c composer_perforce_TEST_depot -p port print '.escapeshellarg('//depot/ASSET.json@10001'), '1.6.*' => 'p4 -u user -c composer_perforce_TEST_depot -p port print //depot/ASSET.json@10001', )); - $this->processExecutor->expects($this->at(1)) + $this->processExecutor->expects(static::at(1)) ->method('execute') - ->with($this->equalTo($expectedCommand)) - ->will( - $this->returnCallback( - function ($command, &$output) { - $output = PerforceTest::getComposerJson(); - - return $command ? true : true; - } - ) + ->with(static::equalTo($expectedCommand)) + ->willReturnCallback( + function ($command, &$output) { + $output = PerforceTest::getComposerJson(); + + return $command ? true : true; + } ) ; @@ -197,7 +191,7 @@ function ($command, &$output) { 'minimum-stability' => 'dev', 'autoload' => array('psr-0' => array()), ); - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } public function testGetComposerInformationWithoutLabelWithStream() @@ -208,17 +202,15 @@ public function testGetComposerInformationWithoutLabelWithStream() '^1.7.0' => 'p4 -u user -c composer_perforce_TEST_depot_branch -p port print '.escapeshellarg('//depot/branch/ASSET.json'), '1.6.*' => 'p4 -u user -c composer_perforce_TEST_depot_branch -p port print //depot/branch/ASSET.json', )); - $this->processExecutor->expects($this->at(0)) + $this->processExecutor->expects(static::at(0)) ->method('execute') - ->with($this->equalTo($expectedCommand)) - ->will( - $this->returnCallback( - function ($command, &$output) { - $output = PerforceTest::getComposerJson(); - - return $command ? true : true; - } - ) + ->with(static::equalTo($expectedCommand)) + ->willReturnCallback( + function ($command, &$output) { + $output = PerforceTest::getComposerJson(); + + return $command ? true : true; + } ) ; @@ -230,7 +222,7 @@ function ($command, &$output) { 'minimum-stability' => 'dev', 'autoload' => array('psr-0' => array()), ); - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } public function testGetComposerInformationWithLabelWithStream() @@ -240,17 +232,15 @@ public function testGetComposerInformationWithLabelWithStream() '^1.7.0' => 'p4 -u user -p port files '.escapeshellarg('//depot/branch/ASSET.json@0.0.1'), '1.6.*' => 'p4 -u user -p port files //depot/branch/ASSET.json@0.0.1', )); - $this->processExecutor->expects($this->at(0)) + $this->processExecutor->expects(static::at(0)) ->method('execute') - ->with($this->equalTo($expectedCommand)) - ->will( - $this->returnCallback( - function ($command, &$output) { - $output = '//depot/ASSET.json#1 - branch change 10001 (text)'; - - return $command ? true : true; - } - ) + ->with(static::equalTo($expectedCommand)) + ->willReturnCallback( + function ($command, &$output) { + $output = '//depot/ASSET.json#1 - branch change 10001 (text)'; + + return $command ? true : true; + } ) ; @@ -258,17 +248,15 @@ function ($command, &$output) { '^1.7.0' => 'p4 -u user -c composer_perforce_TEST_depot_branch -p port print '.escapeshellarg('//depot/branch/ASSET.json@10001'), '1.6.*' => 'p4 -u user -c composer_perforce_TEST_depot_branch -p port print //depot/branch/ASSET.json@10001', )); - $this->processExecutor->expects($this->at(1)) + $this->processExecutor->expects(static::at(1)) ->method('execute') - ->with($this->equalTo($expectedCommand)) - ->will( - $this->returnCallback( - function ($command, &$output) { - $output = PerforceTest::getComposerJson(); - - return $command ? true : true; - } - ) + ->with(static::equalTo($expectedCommand)) + ->willReturnCallback( + function ($command, &$output) { + $output = PerforceTest::getComposerJson(); + + return $command ? true : true; + } ) ; @@ -280,7 +268,7 @@ function ($command, &$output) { 'minimum-stability' => 'dev', 'autoload' => array('psr-0' => array()), ); - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } public function testGetComposerInformationWithLabelButNoSuchFile() @@ -290,23 +278,21 @@ public function testGetComposerInformationWithLabelButNoSuchFile() '^1.7.0' => 'p4 -u user -p port files '.escapeshellarg('//depot/branch/ASSET.json@0.0.1'), '1.6.*' => 'p4 -u user -p port files //depot/branch/ASSET.json@0.0.1', )); - $this->processExecutor->expects($this->at(0)) + $this->processExecutor->expects(static::at(0)) ->method('execute') - ->with($this->equalTo($expectedCommand)) - ->will( - $this->returnCallback( - function ($command, &$output) { - $output = 'no such file(s).'; - - return $command ? true : true; - } - ) + ->with(static::equalTo($expectedCommand)) + ->willReturnCallback( + function ($command, &$output) { + $output = 'no such file(s).'; + + return $command ? true : true; + } ) ; $result = $this->perforce->getComposerInformation('//depot/branch@0.0.1'); - $this->assertNull($result); + static::assertNull($result); } public function testGetComposerInformationWithLabelWithStreamWithNoChange() @@ -316,23 +302,21 @@ public function testGetComposerInformationWithLabelWithStreamWithNoChange() '^1.7.0' => 'p4 -u user -p port files '.escapeshellarg('//depot/branch/ASSET.json@0.0.1'), '1.6.*' => 'p4 -u user -p port files //depot/branch/ASSET.json@0.0.1', )); - $this->processExecutor->expects($this->at(0)) + $this->processExecutor->expects(static::at(0)) ->method('execute') - ->with($this->equalTo($expectedCommand)) - ->will( - $this->returnCallback( - function ($command, &$output) { - $output = '//depot/ASSET.json#1 - branch 10001 (text)'; - - return $command ? true : true; - } - ) + ->with(static::equalTo($expectedCommand)) + ->willReturnCallback( + function ($command, &$output) { + $output = '//depot/ASSET.json#1 - branch 10001 (text)'; + + return $command ? true : true; + } ) ; $result = $this->perforce->getComposerInformation('//depot/branch@0.0.1'); - $this->assertNull($result); + static::assertNull($result); } public function testCheckServerExists() @@ -344,14 +328,14 @@ public function testCheckServerExists() '^1.7.0' => 'p4 -p '.escapeshellarg('perforce.does.exist:port').' info -s', '1.6.*' => 'p4 -p perforce.does.exist:port info -s', )); - $processExecutor->expects($this->at(0)) + $processExecutor->expects(static::at(0)) ->method('execute') - ->with($this->equalTo($expectedCommand), $this->equalTo(null)) - ->will($this->returnValue(0)) + ->with(static::equalTo($expectedCommand), static::equalTo(null)) + ->willReturn(0) ; $result = $this->perforce->checkServerExists('perforce.does.exist:port', $processExecutor); - $this->assertTrue($result); + static::assertTrue($result); } /** @@ -368,14 +352,14 @@ public function testCheckServerClientError() '^1.7.0' => 'p4 -p '.escapeshellarg('perforce.does.exist:port').' info -s', '1.6.*' => 'p4 -p perforce.does.exist:port info -s', )); - $processExecutor->expects($this->at(0)) + $processExecutor->expects(static::at(0)) ->method('execute') - ->with($this->equalTo($expectedCommand), $this->equalTo(null)) - ->will($this->returnValue(127)) + ->with(static::equalTo($expectedCommand), static::equalTo(null)) + ->willReturn(127) ; $result = $this->perforce->checkServerExists('perforce.does.exist:port', $processExecutor); - $this->assertFalse($result); + static::assertFalse($result); } public function testCleanupClientSpecShouldDeleteClient() @@ -389,9 +373,9 @@ public function testCleanupClientSpecShouldDeleteClient() '^1.7.0' => 'p4 -u '.self::TEST_P4USER.' -p '.self::TEST_PORT.' client -d '.escapeshellarg($testClient), '1.6.*' => 'p4 -u '.self::TEST_P4USER.' -p '.self::TEST_PORT.' client -d '.$testClient, )); - $this->processExecutor->expects($this->once())->method('execute')->with($this->equalTo($expectedCommand)); + $this->processExecutor->expects(static::once())->method('execute')->with(static::equalTo($expectedCommand)); - $fs->expects($this->once())->method('remove')->with($this->perforce->getP4ClientSpec()); + $fs->expects(static::once())->method('remove')->with($this->perforce->getP4ClientSpec()); $this->perforce->cleanupClientSpec(); } diff --git a/Tests/Util/ValidatorTest.php b/Tests/Util/ValidatorTest.php index 0f057a4d..7f7ccf04 100644 --- a/Tests/Util/ValidatorTest.php +++ b/Tests/Util/ValidatorTest.php @@ -25,12 +25,12 @@ final class ValidatorTest extends \PHPUnit\Framework\TestCase { public function testValidBranch() { - $this->assertNotFalse(Validator::validateBranch('master')); + static::assertNotFalse(Validator::validateBranch('master')); } public function testInvalidBranch() { - $this->assertFalse(Validator::validateBranch('1.x')); + static::assertFalse(Validator::validateBranch('1.x')); } /** @@ -54,7 +54,7 @@ public function getAssetTypes() public function testValidTag($type) { $assetType = Assets::createType($type); - $this->assertNotFalse(Validator::validateTag('1.0.0', $assetType)); + static::assertNotFalse(Validator::validateTag('1.0.0', $assetType)); } /** @@ -65,6 +65,6 @@ public function testValidTag($type) public function testInvalidTag($type) { $assetType = Assets::createType($type); - $this->assertFalse(Validator::validateTag('version', $assetType)); + static::assertFalse(Validator::validateTag('version', $assetType)); } }