Skip to content

Commit

Permalink
Update php code style
Browse files Browse the repository at this point in the history
  • Loading branch information
francoispluchino committed Aug 8, 2019
1 parent a5679e4 commit 71681c2
Show file tree
Hide file tree
Showing 37 changed files with 1,208 additions and 1,224 deletions.
14 changes: 7 additions & 7 deletions Tests/AssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ final class AssetsTest extends \PHPUnit\Framework\TestCase
{
public function testGetTypes()
{
$this->assertEquals(array(
static::assertEquals(array(
'npm',
'bower',
), Assets::getTypes());
}

public function testDefaultGetRegistries()
{
$this->assertEquals(array(
static::assertEquals(array(
'npm',
'bower',
), array_keys(Assets::getDefaultRegistries()));
}

public function testGetVcsRepositoryDrivers()
{
$this->assertEquals(array(
static::assertEquals(array(
'vcs',
'github',
'git-bitbucket',
Expand All @@ -55,7 +55,7 @@ public function testGetVcsRepositoryDrivers()

public function testGetVcsDrivers()
{
$this->assertEquals(array(
static::assertEquals(array(
'github',
'git-bitbucket',
'git',
Expand All @@ -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);
}
}
54 changes: 27 additions & 27 deletions Tests/Composer/ScriptHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
;
}

Expand Down Expand Up @@ -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));
}
Expand All @@ -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));
}
Expand All @@ -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));
}
Expand All @@ -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();
Expand All @@ -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)
;
}

Expand Down
30 changes: 15 additions & 15 deletions Tests/Config/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
;
Expand Down Expand Up @@ -98,27 +98,27 @@ 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,
'asset-repositories' => 42,
))
;

$this->package->expects($this->any())
$this->package->expects(static::any())
->method('getConfig')
->willReturn(array(
'fxp-asset' => array(
Expand All @@ -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))
;
Expand All @@ -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));
}

/**
Expand All @@ -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');
Expand All @@ -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('<warning>The "extra.'.$option.'" option is deprecated, use the "config.fxp-asset.'.substr($option, 6).'" option</warning>')
;
Expand Down
30 changes: 15 additions & 15 deletions Tests/Converter/AbstractPackageConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 71681c2

Please sign in to comment.