Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dev dependency phpunit to 10 and 11 #42

Merged
merged 12 commits into from
Jun 18, 2024
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.1
coverage: pcov

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"bin": ["bin/phpfci"],
"require": {
"php": ">=8.1",
"php": ">=8.1 || >=8.2",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
Expand All @@ -36,7 +36,7 @@
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.7",
"phpmd/phpmd": "^2.14",
"phpunit/phpunit": "^9.6",
"phpunit/phpunit": "^10.0 || ^11.2",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
Expand Down
9 changes: 4 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
bootstrap="vendor/autoload.php"
forceCoversAnnotation="true"
failOnRisky="true"
failOnWarning="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutResourceUsageDuringSmallTests="true"
beStrictAboutTodoAnnotatedTests="true"
executionOrder="defects"
cacheDirectory=".phpunit.cache"
requireCoverageMetadata="true"
>
<testsuites>
<testsuite name="functional">
Expand All @@ -19,7 +18,7 @@
<directory>tests/Unit</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
use org\bovigo\vfs\vfsStreamFile;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\BufferedOutput;

#[CoversNothing]
class BaselineCommandTest extends TestCase
{
/** @var vfsStreamDirectory */
Expand All @@ -25,7 +27,6 @@ protected function setUp(): void
}

/**
* @coversNothing
* @throws Exception
*/
public function testBaselineCommand(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
use org\bovigo\vfs\vfsStreamFile;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\ExceptionInterface;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;

#[CoversNothing]
class InspectCommandMultiFileTest extends TestCase
{
private vfsStreamDirectory $fileSystem;
Expand All @@ -25,7 +27,6 @@ protected function setUp(): void
}

/**
* @coversNothing
* @throws Exception|ExceptionInterface
*/
public function testInspectCommand(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
use org\bovigo\vfs\vfsStreamFile;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\ExceptionInterface;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;

#[CoversNothing]
class InspectCommandTest extends TestCase
{
private vfsStreamDirectory $fileSystem;
Expand All @@ -27,10 +30,9 @@ protected function setUp(): void
/**
* @param string[] $flags
*
* @coversNothing
* @dataProvider dataProvider
* @throws Exception|ExceptionInterface
*/
#[DataProvider('dataProvider')]
public function testInspectCommand(array $flags, int $exitStatus): void
{
// prepare data files
Expand Down Expand Up @@ -62,7 +64,7 @@ public function testInspectCommand(array $flags, int $exitStatus): void
/**
* @return array<string, array{0: string[], 1:int}>
*/
public function dataProvider(): array
public static function dataProvider(): array
{
return [
'standard exit code' => [[], Command::SUCCESS],
Expand Down
30 changes: 2 additions & 28 deletions tests/Unit/Lib/Config/ConfigFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
use DigitalRevolution\CodeCoverageInspection\Lib\Config\ConfigViolation;
use DigitalRevolution\CodeCoverageInspection\Lib\Config\InspectConfig;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Input\InputInterface;

/**
* @coversDefaultClass \DigitalRevolution\CodeCoverageInspection\Lib\Config\ConfigFactory
* @covers ::getReport
*/
#[CoversClass(ConfigFactory::class)]
class ConfigFactoryTest extends TestCase
{
private ConfigFactory $factory;
Expand All @@ -25,9 +23,6 @@ protected function setUp(): void
$this->factory = new ConfigFactory();
}

/**
* @covers ::createInspectConfig
*/
public function testCreateInspectConfigMinimal(): void
{
$configPath = $this->filepath . 'config.xml';
Expand All @@ -50,9 +45,6 @@ public function testCreateInspectConfigMinimal(): void
static::assertTrue($config->isExitCodeOnFailure());
}

/**
* @covers ::createInspectConfig
*/
public function testCreateInspectConfigMultiReport(): void
{
$configPath = $this->filepath . 'config.xml';
Expand All @@ -75,9 +67,6 @@ public function testCreateInspectConfigMultiReport(): void
static::assertFalse($config->isExitCodeOnFailure());
}

/**
* @covers ::createInspectConfig
*/
public function testCreateInspectConfigInvalidCoverage(): void
{
$configPath = $this->filepath . 'config.xml';
Expand All @@ -93,9 +82,6 @@ public function testCreateInspectConfigInvalidCoverage(): void
static::assertEquals(new ConfigViolation('Coverage argument should be an array'), $config);
}

/**
* @covers ::createInspectConfig
*/
public function testCreateInspectConfigInvalidBaseDir(): void
{
$configPath = $this->filepath . 'config.xml';
Expand All @@ -111,9 +97,6 @@ public function testCreateInspectConfigInvalidBaseDir(): void
static::assertEquals(new ConfigViolation('--base-dir expecting a value string as argument'), $config);
}

/**
* @covers ::createInspectConfig
*/
public function testCreateInspectConfigInvalidGitlabReport(): void
{
$configPath = $this->filepath . 'config.xml';
Expand All @@ -129,9 +112,6 @@ public function testCreateInspectConfigInvalidGitlabReport(): void
static::assertEquals(new ConfigViolation('--reportGitlab expecting the value to absent or string argument'), $config);
}

/**
* @covers ::createInspectConfig
*/
public function testCreateInspectConfigInvalidCheckstyleReport(): void
{
$configPath = $this->filepath . 'config.xml';
Expand All @@ -147,9 +127,6 @@ public function testCreateInspectConfigInvalidCheckstyleReport(): void
static::assertEquals(new ConfigViolation('--reportCheckstyle expecting the value to absent or string argument'), $config);
}

/**
* @covers ::createInspectConfig
*/
public function testCreateInspectConfigInvalidTextReport(): void
{
$configPath = $this->filepath . 'config.xml';
Expand All @@ -165,9 +142,6 @@ public function testCreateInspectConfigInvalidTextReport(): void
static::assertEquals(new ConfigViolation('--reportText expecting the value to absent or string argument'), $config);
}

/**
* @covers ::createInspectConfig
*/
public function testCreateInspectConfigDuplicateOutputReport(): void
{
$configPath = $this->filepath . 'config.xml';
Expand Down
9 changes: 2 additions & 7 deletions tests/Unit/Lib/Config/ConfigViolationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@

use DigitalRevolution\AccessorPairConstraint\AccessorPairAsserter;
use DigitalRevolution\CodeCoverageInspection\Lib\Config\ConfigViolation;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;

/**
* @coversDefaultClass \DigitalRevolution\CodeCoverageInspection\Lib\Config\ConfigViolation
* @covers ::__construct
*/
#[CoversClass(ConfigViolation::class)]
class ConfigViolationTest extends TestCase
{
use AccessorPairAsserter;

/**
* @covers ::<public>
*/
public function testAccessorPairs(): void
{
static::assertAccessorPairs(ConfigViolation::class);
Expand Down
9 changes: 2 additions & 7 deletions tests/Unit/Lib/Config/InspectConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@

use DigitalRevolution\AccessorPairConstraint\AccessorPairAsserter;
use DigitalRevolution\CodeCoverageInspection\Lib\Config\InspectConfig;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;

/**
* @coversDefaultClass \DigitalRevolution\CodeCoverageInspection\Lib\Config\InspectConfig
* @covers ::__construct
*/
#[CoversClass(InspectConfig::class)]
class InspectConfigTest extends TestCase
{
use AccessorPairAsserter;

/**
* @covers ::<public>
*/
public function testAccessorPairs(): void
{
static::assertAccessorPairs(InspectConfig::class);
Expand Down
24 changes: 2 additions & 22 deletions tests/Unit/Lib/IO/DOMDocumentFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
namespace DigitalRevolution\CodeCoverageInspection\Tests\Unit\Lib\IO;

use DigitalRevolution\CodeCoverageInspection\Lib\IO\DOMDocumentFactory;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use RuntimeException;
use SplFileInfo;

/**
* @coversDefaultClass \DigitalRevolution\CodeCoverageInspection\Lib\IO\DOMDocumentFactory
*/
#[CoversClass(DOMDocumentFactory::class)]
class DOMDocumentFactoryTest extends TestCase
{
/** @var resource */
Expand All @@ -27,9 +26,6 @@ protected function setUp(): void
$this->schemaPath = dirname(__DIR__, 4) . '/resources/phpfci.xsd';
}

/**
* @covers ::getDOMDocument
*/
public function testGetDOMDocumentMissingFileShouldFail(): void
{
$file = new SplFileInfo('/a/b/c');
Expand All @@ -38,10 +34,6 @@ public function testGetDOMDocumentMissingFileShouldFail(): void
DOMDocumentFactory::getDOMDocument($file);
}

/**
* @covers ::getDOMDocument
* @covers ::getValidatedDOMDocument
*/
public function testGetDOMDocumentShouldPass(): void
{
$xml = '<?xml version="1.0" encoding="UTF-8"?>
Expand All @@ -56,10 +48,6 @@ public function testGetDOMDocumentShouldPass(): void
static::assertSame('1.0', $dom->xmlVersion);
}

/**
* @covers ::getDOMDocument
* @covers ::getValidatedDOMDocument
*/
public function testGetDOMDocumentWithoutCustomCoverageShouldPass(): void
{
$xml = '<?xml version="1.0" encoding="UTF-8"?>
Expand All @@ -71,10 +59,6 @@ public function testGetDOMDocumentWithoutCustomCoverageShouldPass(): void
static::assertSame('1.0', $dom->xmlVersion);
}

/**
* @covers ::getDOMDocument
* @covers ::getValidatedDOMDocument
*/
public function testGetDOMDocumentWithInvalidCoverageShouldFail(): void
{
$xml = '<?xml version="1.0" encoding="UTF-8"?>
Expand All @@ -88,10 +72,6 @@ public function testGetDOMDocumentWithInvalidCoverageShouldFail(): void
DOMDocumentFactory::getValidatedDOMDocument($this->fileInfo, $this->schemaPath);
}

/**
* @covers ::getDOMDocument
* @covers ::getValidatedDOMDocument
*/
public function testGetDOMDocumentWithInvalidCoverage(): void
{
$xml = '<?xml version="1.0" encoding="UTF-8"?>
Expand Down
7 changes: 2 additions & 5 deletions tests/Unit/Lib/IO/IgnoreUncoveredMethodFileFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
use DigitalRevolution\CodeCoverageInspection\Lib\IO\IgnoreUncoveredMethodFileFactory;
use DOMDocument;
use DOMException;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use RuntimeException;

/**
* @coversDefaultClass \DigitalRevolution\CodeCoverageInspection\Lib\IO\IgnoreUncoveredMethodFileFactory
*/
#[CoversClass(IgnoreUncoveredMethodFileFactory::class)]
class IgnoreUncoveredMethodFileFactoryTest extends TestCase
{
/**
* @covers ::createFromNode
* @throws DOMException
*/
public function testCreateFromNodeInvalidNodeThrowsException(): void
Expand All @@ -29,7 +27,6 @@ public function testCreateFromNodeInvalidNodeThrowsException(): void
}

/**
* @covers ::createFromNode
* @throws DOMException
*/
public function testCreateFromNode(): void
Expand Down
Loading