diff --git a/composer.json b/composer.json index d736272..84df861 100644 --- a/composer.json +++ b/composer.json @@ -2,18 +2,18 @@ "name": "magento/composer", "description": "Magento composer library helps to instantiate Composer application and run composer commands.", "type": "library", - "version": "1.1.0", + "version": "1.6.0", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "php": "~5.5.0|~5.6.0|~7.0.0", - "composer/composer": "1.0.0-beta1", - "symfony/console": "~2.3, !=2.7.0" + "php": "~7.3.0||~7.4.0", + "composer/composer": "^1.9", + "symfony/console": "~4.4.0" }, "require-dev": { - "phpunit/phpunit": "4.1.0" + "phpunit/phpunit": "^9" }, "autoload": { "psr-4": { diff --git a/tests/Composer/ConsoleArrayInputFactoryTest.php b/tests/Composer/ConsoleArrayInputFactoryTest.php index 0846b11..ac526c9 100644 --- a/tests/Composer/ConsoleArrayInputFactoryTest.php +++ b/tests/Composer/ConsoleArrayInputFactoryTest.php @@ -6,7 +6,7 @@ use Magento\Composer\ConsoleArrayInputFactory; -class ConsoleArrayInputFactoryTest extends PHPUnit_Framework_TestCase +class ConsoleArrayInputFactoryTest extends \PHPUnit\Framework\TestCase { /** @@ -14,13 +14,13 @@ class ConsoleArrayInputFactoryTest extends PHPUnit_Framework_TestCase */ protected $factory; - protected function setUp() + protected function setUp(): void { $this->factory = new ConsoleArrayInputFactory(); } public function testCreate() { - $this->assertInstanceOf('\Symfony\Component\Console\Input\ArrayInput', $this->factory->create([])); + $this->assertInstanceOf(\Symfony\Component\Console\Input\ArrayInput::class, $this->factory->create([])); } } diff --git a/tests/Composer/InfoCommandTest.php b/tests/Composer/InfoCommandTest.php index 7b42758..63dbb92 100644 --- a/tests/Composer/InfoCommandTest.php +++ b/tests/Composer/InfoCommandTest.php @@ -7,7 +7,7 @@ use Magento\Composer\MagentoComposerApplication; use Magento\Composer\InfoCommand; -class InfoCommandTest extends PHPUnit_Framework_TestCase +class InfoCommandTest extends \PHPUnit\Framework\TestCase { private $installedOutput = 'name : 3rdp/a @@ -31,9 +31,9 @@ class InfoCommandTest extends PHPUnit_Framework_TestCase */ protected $infoCommand; - protected function setUp() + protected function setUp(): void { - $this->application = $this->getMock('Magento\Composer\MagentoComposerApplication', [], [], '', false, false); + $this->application = $this->createMock(\Magento\Composer\MagentoComposerApplication::class); $this->infoCommand = new InfoCommand($this->application); } diff --git a/tests/Composer/MagentoComposerApplicationTest.php b/tests/Composer/MagentoComposerApplicationTest.php index abf1814..75619c5 100644 --- a/tests/Composer/MagentoComposerApplicationTest.php +++ b/tests/Composer/MagentoComposerApplicationTest.php @@ -9,7 +9,7 @@ use Magento\Composer\ConsoleArrayInputFactory; use Symfony\Component\Console\Output\BufferedOutput; -class MagentoComposerApplicationTest extends PHPUnit_Framework_TestCase +class MagentoComposerApplicationTest extends \PHPUnit\Framework\TestCase { /** * @var MagentoComposerApplication @@ -31,22 +31,11 @@ class MagentoComposerApplicationTest extends PHPUnit_Framework_TestCase */ protected $consoleOutput; - protected function setUp() + protected function setUp(): void { - $this->composerApplication = $this->getMock( - 'Composer\Console\Application', - [ - 'resetComposer', - 'create', - 'run' - ], - [], - '', - false, - false - ); - $this->inputFactory = $this->getMock('Magento\Composer\ConsoleArrayInputFactory', [], [], '', false); - $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\BufferedOutput', [], [], '', false); + $this->composerApplication = $this->createMock(\Composer\Console\Application::class); + $this->inputFactory = $this->createMock(\Magento\Composer\ConsoleArrayInputFactory::class); + $this->consoleOutput = $this->createMock(\Symfony\Component\Console\Output\BufferedOutput::class); $this->application = new MagentoComposerApplication( 'path1', @@ -57,13 +46,11 @@ protected function setUp() ); } - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage Command "update" failed - */ function testWrongExitCode() { $this->composerApplication->expects($this->once())->method('run')->willReturn(1); + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage('Command "update" failed'); $this->application->runComposerCommand(['command'=>'update']); } diff --git a/tests/Composer/RequireUpdateDryRunCommandTest.php b/tests/Composer/RequireUpdateDryRunCommandTest.php index 24d1346..1c97213 100644 --- a/tests/Composer/RequireUpdateDryRunCommandTest.php +++ b/tests/Composer/RequireUpdateDryRunCommandTest.php @@ -8,7 +8,7 @@ use Magento\Composer\InfoCommand; use Magento\Composer\RequireUpdateDryRunCommand; -class RequireUpdateDryRunCommandTest extends PHPUnit_Framework_TestCase +class RequireUpdateDryRunCommandTest extends \PHPUnit\Framework\TestCase { /** * @var MagentoComposerApplication|\PHPUnit_Framework_MockObject_MockObject @@ -62,10 +62,10 @@ class RequireUpdateDryRunCommandTest extends PHPUnit_Framework_TestCase ] ]; - protected function setUp() + protected function setUp(): void { - $this->application = $this->getMock('Magento\Composer\MagentoComposerApplication', [], [], '', false, false); - $this->infoCommand = $this->getMock('Magento\Composer\InfoCommand', [], [], '', false, false); + $this->application = $this->createMock(\Magento\Composer\MagentoComposerApplication::class); + $this->infoCommand = $this->createMock(\Magento\Composer\InfoCommand::class); $this->requireUpdateDryRunCommand = new RequireUpdateDryRunCommand( $this->application, @@ -79,15 +79,12 @@ public function testRun() $this->requireUpdateDryRunCommand->run([], ''); } - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage - */ public function testRunException() { $this->application->expects($this->at(1)) ->method('runComposerCommand') ->willThrowException(new \RuntimeException($this->errorMessage)); + $this->expectException(\RuntimeException::class); $this->infoCommand->expects($this->once())->method('run')->willReturn($this->packageInfo); $this->requireUpdateDryRunCommand->run(['3rdp/e 1.2.0'], ''); }