From e0f5bd7ab8611e4c7ac7889e90d85f3ad5899cfe Mon Sep 17 00:00:00 2001 From: Florian Weber Date: Sat, 14 Nov 2020 21:39:08 +0100 Subject: [PATCH 1/2] Skip testing of unsupported PHP versions ... but keep PHP 5.6 for Drupal 7 --- .travis.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 649fb3f..4c793e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,10 @@ language: php dist: trusty php: - - "5.4" - - "5.5" - "5.6" - - "7.0" - - "7.1" -matrix: - include: - - php: "5.3" - dist: precise + - "7.2" + - "7.3" + - "7.4" install: - composer install script: From 91fab4233c0581fd13e5a23f2449556c68c4173a Mon Sep 17 00:00:00 2001 From: Florian Weber Date: Sat, 14 Nov 2020 22:15:07 +0100 Subject: [PATCH 2/2] Drop PHP 5.6 to support PHP 7.4 ... testing both versions in PHPUnit is not possible. --- .travis.yml | 1 - composer.json | 2 +- tests/FixturesTest.php | 15 ++++++++------- tests/PathPreserverTest.php | 24 ++++++++++++++++-------- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4c793e2..af8a897 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php dist: trusty php: - - "5.6" - "7.2" - "7.3" - "7.4" diff --git a/composer.json b/composer.json index 11848ba..71839a0 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "require-dev": { "composer/composer": "^2.0", - "phpunit/phpunit": "4.*", + "phpunit/phpunit": "^8.5.9", "derhasi/tempdirectory": "0.1.*", "squizlabs/php_codesniffer": "2.*", "escapestudios/symfony2-coding-standard": "2.*" diff --git a/tests/FixturesTest.php b/tests/FixturesTest.php index c36bcbc..90aa72c 100644 --- a/tests/FixturesTest.php +++ b/tests/FixturesTest.php @@ -3,11 +3,12 @@ namespace DrupalComposer\PreservePaths\Tests; use derhasi\tempdirectory\TempDirectory; +use PHPUnit\Framework\TestCase; /** * Tests for some examples. */ -class FixturesTest extends \PHPUnit_Framework_TestCase +class FixturesTest extends TestCase { /** @@ -28,7 +29,7 @@ class FixturesTest extends \PHPUnit_Framework_TestCase /** * Set up test. */ - protected function setUp() + protected function setUp(): void { $this->projectRoot = realpath(__DIR__.'/..'); $this->composerBin = realpath(__DIR__.'/../vendor/bin/composer'); @@ -57,7 +58,7 @@ public function testFixtures($folder, $commands = array(), $files = array()) // Add this project as local development repository sow we work with // the latest code. $this->composer('config', 'repositories.dev', 'path', $this->projectRoot); - + $output = $this->composer('install'); // Check for deprecation notices. @@ -67,12 +68,12 @@ public function testFixtures($folder, $commands = array(), $files = array()) foreach ($commands as $command) { call_user_func_array(array($this, 'composer'), $command); } - + // Check for file existance. foreach ($files as $file) { $this->assertFileExists($file); } - + unset($workingDirectory); } @@ -94,7 +95,7 @@ public function fixturesProvider() ), ); } - + /** * Run composer command. * @@ -134,7 +135,7 @@ protected function composer($command) protected function assertDeprecationNotice($lines) { foreach ($lines as $line) { - $this->assertNotContains('Deprecation Notice:', $line); + $this->assertStringNotContainsString('Deprecation Notice:', $line); } } } diff --git a/tests/PathPreserverTest.php b/tests/PathPreserverTest.php index 3ad344c..03aff13 100644 --- a/tests/PathPreserverTest.php +++ b/tests/PathPreserverTest.php @@ -2,27 +2,35 @@ namespace DrupalComposer\PreservePaths\Tests; -use DrupalComposer\PreservePaths\PathPreserver; +use Composer\IO\IOInterface; use Composer\Util\Filesystem; -use Composer\Package\Package; -use Composer\Package\RootPackage; -use Composer\Composer; -use Composer\Config; use derhasi\tempdirectory\TempDirectory; +use DrupalComposer\PreservePaths\PathPreserver; +use PHPUnit\Framework\TestCase; /** * Test for path preserver functionality. */ -class PathPreserverTest extends \PHPUnit_Framework_TestCase +class PathPreserverTest extends TestCase { + /** + * @var \Composer\Util\Filesystem + */ + protected $fs; + + /** + * @var \Composer\IO\IOInterface + */ + protected $io; + /** * set up test environmemt */ - public function setUp() + protected function setUp(): void { $this->fs = new Filesystem(); - $this->io = $this->getMock('Composer\IO\IOInterface'); + $this->io = $this->getMockBuilder(IOInterface::class)->getMock(); } /**