Skip to content

Commit

Permalink
Merge pull request #10 from timoschinkel/update-phpunit
Browse files Browse the repository at this point in the history
Update PHPUnit to `^9.4`
  • Loading branch information
timoschinkel authored Nov 29, 2020
2 parents de86d3b + e7c8f68 commit 60be6f4
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 26 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: php
php:
- '7.2'
- '7.3'
- '7.4'

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
}
}
30 changes: 11 additions & 19 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
failOnRisky="true"
failOnWarning="true"
verbose="true"
>
<testsuites>
<testsuite name="CodeOwners Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" colors="true" failOnRisky="true" failOnWarning="true" verbose="true">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="CodeOwners Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
3 changes: 3 additions & 0 deletions tests/Command/ListFilesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
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;
use Symfony\Component\Console\Tester\CommandTester;

final class ListFilesCommandTest extends TestCase
{
use ProphecyTrait;

/** @var FileLocatorFactoryInterface|ObjectProphecy */
private $fileLocatorFactory;

Expand Down
3 changes: 3 additions & 0 deletions tests/Command/ListOwnersCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,6 +23,8 @@

final class ListOwnersCommandTest extends TestCase
{
use ProphecyTrait;

/** @var FileLocatorFactoryInterface|ObjectProphecy */
private $fileLocatorFactory;

Expand Down
9 changes: 6 additions & 3 deletions tests/Command/OwnerCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,6 +25,8 @@

final class OwnerCommandTest extends TestCase
{
use ProphecyTrait;

/** @var FileLocatorFactoryInterface|ObjectProphecy */
private $fileLocatorFactory;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 60be6f4

Please sign in to comment.