From e7c8f681444f546c9d204c749e70b795dcfab950 Mon Sep 17 00:00:00 2001 From: Timo Schinkel Date: Sun, 29 Nov 2020 15:49:07 +0100 Subject: [PATCH] Update PHPUnit to `^9.4` In preparation of supporting PHP 8 - and because it is good practice - update PHPUnit requirement to `^9.4`. This has the side effect that support for PHP 7.2 is dropped. - Update PHP requirement from `^7.2` to `^7.3` - Update PHPUnit requirement to `^9.4` - Add development dependency `phpspec/prophecy-phpunit` to remedy the deprecation warnings that Prophecy will be removed from PHPUnit 10 - Replace calls to `TestCase::assertRegExp()` to calls to `TestCase::assertMatchesRegularExpression()` --- .travis.yml | 1 - CHANGELOG.md | 5 +++++ composer.json | 7 +++--- phpunit.xml.dist | 30 +++++++++---------------- tests/Command/ListFilesCommandTest.php | 3 +++ tests/Command/ListOwnersCommandTest.php | 3 +++ tests/Command/OwnerCommandTest.php | 9 +++++--- 7 files changed, 32 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index fdf246f..eec5a6f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: php php: - - '7.2' - '7.3' - '7.4' diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d41a66..89f16fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Added development dependency to `phpspec/prophecy-phpunit` + ### Changed +- Updated PHP requirements from `^7.2` to `^7.3` - Updated Psalm requirements to `^4.2` +- Updated PHPUnit requirements to `^9.4` ## [1.1.0] - 2020-01-23 ### Added diff --git a/composer.json b/composer.json index be07c39..a801088 100755 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "project", "license": "Apache-2.0", "require": { - "php": "^7.2", + "php": "^7.3", "symfony/console": "^5.0", "timoschinkel/codeowners": "^1.1.0", "symfony/finder": "^5.0" @@ -19,7 +19,8 @@ "require-dev": { "squizlabs/php_codesniffer": "^3.5", "vimeo/psalm": "^4.2", - "phpunit/phpunit": "^8.5", - "mikey179/vfsstream": "^1.6" + "phpunit/phpunit": "^9.4", + "mikey179/vfsstream": "^1.6", + "phpspec/prophecy-phpunit": "^2.0" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 24f6f41..072c231 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,21 +1,13 @@ - - - - ./tests - - - - - - src - - + + + + src + + + + + ./tests + + diff --git a/tests/Command/ListFilesCommandTest.php b/tests/Command/ListFilesCommandTest.php index 3f68932..aa38208 100644 --- a/tests/Command/ListFilesCommandTest.php +++ b/tests/Command/ListFilesCommandTest.php @@ -15,6 +15,7 @@ use org\bovigo\vfs\vfsStream; use PHPUnit\Framework\TestCase; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; @@ -22,6 +23,8 @@ final class ListFilesCommandTest extends TestCase { + use ProphecyTrait; + /** @var FileLocatorFactoryInterface|ObjectProphecy */ private $fileLocatorFactory; diff --git a/tests/Command/ListOwnersCommandTest.php b/tests/Command/ListOwnersCommandTest.php index 93bb037..309b085 100644 --- a/tests/Command/ListOwnersCommandTest.php +++ b/tests/Command/ListOwnersCommandTest.php @@ -14,6 +14,7 @@ use org\bovigo\vfs\vfsStream; use PHPUnit\Framework\TestCase; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; @@ -22,6 +23,8 @@ final class ListOwnersCommandTest extends TestCase { + use ProphecyTrait; + /** @var FileLocatorFactoryInterface|ObjectProphecy */ private $fileLocatorFactory; diff --git a/tests/Command/OwnerCommandTest.php b/tests/Command/OwnerCommandTest.php index 64ed23b..70b3e7e 100644 --- a/tests/Command/OwnerCommandTest.php +++ b/tests/Command/OwnerCommandTest.php @@ -15,6 +15,7 @@ use org\bovigo\vfs\vfsStream; use PHPUnit\Framework\TestCase; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; @@ -24,6 +25,8 @@ final class OwnerCommandTest extends TestCase { + use ProphecyTrait; + /** @var FileLocatorFactoryInterface|ObjectProphecy */ private $fileLocatorFactory; @@ -82,9 +85,9 @@ public function testCommandDisplaysOwnersFoundForPaths(): void $output = $this->executeCommand($command, ['paths' => ['file-a', 'file-b', 'file-non-existent']]); - self::assertRegExp('/"file-a".+"@owner-a" and "@owner-b"/m', $output); - self::assertRegExp('/"file-b".+no code owner/m', $output); - self::assertRegExp('/"file-non-existent".+does not exist/m', $output); + self::assertMatchesRegularExpression('/"file-a".+"@owner-a" and "@owner-b"/m', $output); + self::assertMatchesRegularExpression('/"file-b".+no code owner/m', $output); + self::assertMatchesRegularExpression('/"file-non-existent".+does not exist/m', $output); } public function testCommandPassesCodeownerFileLocation(): void