From 319ce7963caa2bf09a7558108279354cf7761236 Mon Sep 17 00:00:00 2001 From: Patrick McLain Date: Wed, 31 Jan 2018 18:08:17 -0500 Subject: [PATCH 1/2] Update PHPUnit and tests and add PHP 7.2 to composer.json * Update PHPUnit to version supported by PHP 7.2 * Fix unit tests for updated PHPUnit version --- composer.json | 4 ++-- .../Composer/ConsoleArrayInputFactoryTest.php | 4 ++-- tests/Composer/InfoCommandTest.php | 4 ++-- .../MagentoComposerApplicationTest.php | 19 ++++--------------- .../RequireUpdateDryRunCommandTest.php | 6 +++--- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/composer.json b/composer.json index 4d4466c..dbee64f 100644 --- a/composer.json +++ b/composer.json @@ -8,12 +8,12 @@ "AFL-3.0" ], "require": { - "php": "~5.5.0|~5.6.0|~7.0.0|~7.1.0", + "php": "~5.5.0|~5.6.0|~7.0.0|~7.1.0|~7.2.0", "composer/composer": "1.4.1", "symfony/console": "~2.3, !=2.7.0" }, "require-dev": { - "phpunit/phpunit": "4.1.0" + "phpunit/phpunit": "~6.2.0" }, "autoload": { "psr-4": { diff --git a/tests/Composer/ConsoleArrayInputFactoryTest.php b/tests/Composer/ConsoleArrayInputFactoryTest.php index 0846b11..5b13e25 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 { /** @@ -21,6 +21,6 @@ protected function setUp() 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..e780e95 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 @@ -33,7 +33,7 @@ class InfoCommandTest extends PHPUnit_Framework_TestCase protected function setUp() { - $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..ee843e0 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 @@ -33,20 +33,9 @@ class MagentoComposerApplicationTest extends PHPUnit_Framework_TestCase protected function setUp() { - $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', diff --git a/tests/Composer/RequireUpdateDryRunCommandTest.php b/tests/Composer/RequireUpdateDryRunCommandTest.php index 24d1346..777d3dc 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 @@ -64,8 +64,8 @@ class RequireUpdateDryRunCommandTest extends PHPUnit_Framework_TestCase protected function setUp() { - $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, From 70b9f602187a9f92402488fcee160f902a0b1cf0 Mon Sep 17 00:00:00 2001 From: Patrick McLain Date: Thu, 8 Feb 2018 15:38:34 -0500 Subject: [PATCH 2/2] Update dependencies --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index dbee64f..85a47e1 100644 --- a/composer.json +++ b/composer.json @@ -2,15 +2,15 @@ "name": "magento/composer", "description": "Magento composer library helps to instantiate Composer application and run composer commands.", "type": "library", - "version": "1.2.0", + "version": "1.3.0", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { "php": "~5.5.0|~5.6.0|~7.0.0|~7.1.0|~7.2.0", - "composer/composer": "1.4.1", - "symfony/console": "~2.3, !=2.7.0" + "composer/composer": "~1.6.0", + "symfony/console": "~4.0.0" }, "require-dev": { "phpunit/phpunit": "~6.2.0"