Skip to content

Commit

Permalink
⬆️ PHPUnit 11 (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpi authored Jun 4, 2024
1 parent 19ca952 commit 8116e70
Show file tree
Hide file tree
Showing 26 changed files with 94 additions and 88 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.2', '8.3']
steps:
- uses: actions/checkout@v4
- uses: "shivammathur/setup-php@v2"
Expand All @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.2', '8.3']
steps:
- uses: actions/checkout@v4
- uses: "shivammathur/setup-php@v2"
Expand All @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.2', '8.3']
dependency-versions: ['highest', 'lowest']
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"homepage": "https://github.com/previousnext/coding-standard",
"keywords": ["drupal", "phpcs"],
"require": {
"php": "^8.1",
"php": "^8.2",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"drupal/coder": "^8.3.24",
"slevomat/coding-standard": "^8.15.0",
Expand All @@ -15,7 +15,7 @@
"phpstan/phpstan": "^1.11.3",
"phpstan/phpstan-deprecation-rules": "^1.2.0",
"phpstan/phpstan-strict-rules": "^1.6.0",
"phpunit/phpunit": "^9.6.19"
"phpunit/phpunit": "^11"
},
"license": "MIT",
"autoload": {
Expand Down
5 changes: 4 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
<rule ref="PreviousNextDrupal" />
<arg name="report" value="full"/>

<!-- Most functions are tests, and are self documenting. -->
<!-- Most classes and functions are tests, and are self documenting. -->
<rule ref="Drupal.Commenting.ClassComment.Missing">
<exclude-pattern>./tests/*</exclude-pattern>
</rule>
<rule ref="Drupal.Commenting.FunctionComment.Missing">
<exclude-pattern>./tests/*</exclude-pattern>
</rule>
Expand Down
33 changes: 16 additions & 17 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="tests/bootstrap.php"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.1/phpunit.xsd"
bootstrap="tests/bootstrap.php"
executionOrder="depends,defects"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
failOnWarning="true"
cacheDirectory=".phpunit.cache"
beStrictAboutCoverageMetadata="true"
>
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
7 changes: 4 additions & 3 deletions tests/Ignore/IgnoreDocCommentSniffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\DocCommentSniff
*/
use PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\DocCommentSniff;
use PHPUnit\Framework\Attributes\CoversClass;

#[CoversClass(DocCommentSniff::class)]
final class IgnoreDocCommentSniffTest extends Base {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \Drupal\Sniffs\Arrays\ArraySniff
*/
use Drupal\Sniffs\Arrays\ArraySniff;
use PHPUnit\Framework\Attributes\CoversClass;

#[CoversClass(ArraySniff::class)]
final class IgnoreDrupalArraysArrayLongLineDeclarationTest extends Base {

/**
Expand Down
7 changes: 4 additions & 3 deletions tests/Ignore/IgnoreDrupalCommentingClassCommentShortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \Drupal\Sniffs\Commenting\ClassCommentSniff
*/
use Drupal\Sniffs\Commenting\ClassCommentSniff;
use PHPUnit\Framework\Attributes\CoversClass;

#[CoversClass(ClassCommentSniff::class)]
final class IgnoreDrupalCommentingClassCommentShortTest extends Base {

/**
Expand Down
7 changes: 4 additions & 3 deletions tests/Ignore/IgnoreDrupalCommentingFunctionCommentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FunctionCommentSniff
*/
use PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FunctionCommentSniff;
use PHPUnit\Framework\Attributes\CoversClass;

#[CoversClass(FunctionCommentSniff::class)]
final class IgnoreDrupalCommentingFunctionCommentTest extends Base {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \Drupal\Sniffs\Commenting\TodoCommentSniff
*/
use Drupal\Sniffs\Commenting\TodoCommentSniff;
use PHPUnit\Framework\Attributes\CoversClass;

#[CoversClass(TodoCommentSniff::class)]
final class IgnoreDrupalCommentingTodoCommentTodoFormatTest extends Base {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \Drupal\Sniffs\Commenting\VariableCommentSniff
*/
use Drupal\Sniffs\Commenting\VariableCommentSniff;
use PHPUnit\Framework\Attributes\CoversClass;

#[CoversClass(VariableCommentSniff::class)]
final class IgnoreDrupalCommentingVariableCommentMissingTest extends Base {

public function testIgnored(): void {
Expand Down
7 changes: 4 additions & 3 deletions tests/Ignore/IgnoreUnreachableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Ignore;

/**
* @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\NonExecutableCodeSniff
*/
use PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\NonExecutableCodeSniff;
use PHPUnit\Framework\Attributes\CoversClass;

#[CoversClass(NonExecutableCodeSniff::class)]
final class IgnoreUnreachableTest extends Base {

public function testIgnored(): void {
Expand Down
5 changes: 2 additions & 3 deletions tests/Sniffs/AlphabeticallySortedUsesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Namespaces\AlphabeticallySortedUsesSniff;

/**
* @covers \SlevomatCodingStandard\Sniffs\Namespaces\AlphabeticallySortedUsesSniff
*/
#[CoversClass(AlphabeticallySortedUsesSniff::class)]
final class AlphabeticallySortedUsesTest extends Base {

public function testNoError(): void {
Expand Down
5 changes: 2 additions & 3 deletions tests/Sniffs/ClassStructureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Classes\ClassStructureSniff;

/**
* @covers \SlevomatCodingStandard\Sniffs\Classes\ClassStructureSniff
*/
#[CoversClass(ClassStructureSniff::class)]
final class ClassStructureTest extends Base {

public function testNoError(): void {
Expand Down
5 changes: 2 additions & 3 deletions tests/Sniffs/FullyQualifiedGlobalFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedGlobalFunctionsSniff;

/**
* @covers \SlevomatCodingStandard\Sniffs\Namespaces\FullyQualifiedGlobalFunctionsSniff
*/
#[CoversClass(FullyQualifiedGlobalFunctionsSniff::class)]
final class FullyQualifiedGlobalFunctionsTest extends Base {

public function testNoError(): void {
Expand Down
7 changes: 4 additions & 3 deletions tests/Sniffs/FunctionClosingBraceSpacingBeforeCloseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

/**
* @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\FunctionOpeningBraceSpaceSniff
*/
use PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\FunctionOpeningBraceSpaceSniff;
use PHPUnit\Framework\Attributes\CoversClass;

#[CoversClass(FunctionOpeningBraceSpaceSniff::class)]
final class FunctionClosingBraceSpacingBeforeCloseTest extends Base {

public function testNoError(): void {
Expand Down
7 changes: 4 additions & 3 deletions tests/Sniffs/FunctionOpeningBraceSpaceSpacingAfterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

/**
* @covers \PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\FunctionOpeningBraceSpaceSniff
*/
use PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\FunctionOpeningBraceSpaceSniff;
use PHPUnit\Framework\Attributes\CoversClass;

#[CoversClass(FunctionOpeningBraceSpaceSniff::class)]
final class FunctionOpeningBraceSpaceSpacingAfterTest extends Base {

public function testNoError(): void {
Expand Down
7 changes: 4 additions & 3 deletions tests/Sniffs/FunctionsStaticClosureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

/**
* @covers \SlevomatCodingStandard\Sniffs\Functions\StaticClosureSniff
*/
use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Functions\StaticClosureSniff;

#[CoversClass(StaticClosureSniff::class)]
final class FunctionsStaticClosureTest extends Base {

public function testNoError(): void {
Expand Down
7 changes: 4 additions & 3 deletions tests/Sniffs/RequireMultiLineMethodSignatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

/**
* @covers \SlevomatCodingStandard\Sniffs\Classes\RequireMultiLineMethodSignatureSniff
*/
use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Classes\RequireMultiLineMethodSignatureSniff;

#[CoversClass(RequireMultiLineMethodSignatureSniff::class)]
final class RequireMultiLineMethodSignatureTest extends Base {

public function testNoError(): void {
Expand Down
5 changes: 2 additions & 3 deletions tests/Sniffs/RequireNullSafeObjectOperatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\ControlStructures\RequireNullSafeObjectOperatorSniff;

/**
* @covers \SlevomatCodingStandard\Sniffs\ControlStructures\RequireNullSafeObjectOperatorSniff
*/
#[CoversClass(RequireNullSafeObjectOperatorSniff::class)]
final class RequireNullSafeObjectOperatorTest extends Base {

public function testNoError(): void {
Expand Down
5 changes: 2 additions & 3 deletions tests/Sniffs/RequireTrailingCommaInCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Functions\RequireTrailingCommaInDeclarationSniff;

/**
* @covers \SlevomatCodingStandard\Sniffs\Functions\RequireTrailingCommaInDeclarationSniff
*/
#[CoversClass(RequireTrailingCommaInDeclarationSniff::class)]
final class RequireTrailingCommaInCallTest extends Base {

public function testNoError(): void {
Expand Down
7 changes: 4 additions & 3 deletions tests/Sniffs/RequireTrailingCommaInDeclarationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

/**
* @covers \SlevomatCodingStandard\Sniffs\Classes\RequireMultiLineMethodSignatureSniff
*/
use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Classes\RequireMultiLineMethodSignatureSniff;

#[CoversClass(RequireMultiLineMethodSignatureSniff::class)]
final class RequireTrailingCommaInDeclarationTest extends Base {

public function testNoError(): void {
Expand Down
5 changes: 2 additions & 3 deletions tests/Sniffs/ReturnTypeHintSpacingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSpacingSniff;

/**
* @covers \SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSpacingSniff
*/
#[CoversClass(ReturnTypeHintSpacingSniff::class)]
final class ReturnTypeHintSpacingTest extends Base {

public function testNoError(): void {
Expand Down
5 changes: 3 additions & 2 deletions tests/Sniffs/ReturnTypeHintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff;

/**
* @covers \SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff
* @see https://github.com/slevomat/coding-standard/blob/master/doc/type-hints.md#slevomatcodingstandardtypehintsreturntypehint-
*/
#[CoversClass(ReturnTypeHintSniff::class)]
final class ReturnTypeHintTest extends Base {

public function testNoError(): void {
Expand All @@ -20,7 +21,7 @@ public function testNoError(): void {
/**
* Ensures traversables do not need to be fully documented.
*
* @covers \SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff::CODE_MISSING_TRAVERSABLE_TYPE_HINT_SPECIFICATION
* @see \SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff::CODE_MISSING_TRAVERSABLE_TYPE_HINT_SPECIFICATION
*/
public function testIgnoreTraversable(): void {
$report = self::checkFile(__DIR__ . '/fixtures/ReturnTypeHintIgnoreTraversable.php');
Expand Down
5 changes: 2 additions & 3 deletions tests/Sniffs/StrictTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff;

/**
* @covers \SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff
*/
#[CoversClass(DeclareStrictTypesSniff::class)]
final class StrictTypesTest extends Base {

public function testNoError(): void {
Expand Down
5 changes: 2 additions & 3 deletions tests/Sniffs/UnusedInheritedVariablePassedToClosureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

use PHPUnit\Framework\Attributes\CoversClass;
use SlevomatCodingStandard\Sniffs\Functions\UnusedInheritedVariablePassedToClosureSniff;

/**
* @covers \SlevomatCodingStandard\Sniffs\Functions\UnusedInheritedVariablePassedToClosureSniff
*/
#[CoversClass(UnusedInheritedVariablePassedToClosureSniff::class)]
final class UnusedInheritedVariablePassedToClosureTest extends Base {

public function testNoError(): void {
Expand Down
Loading

0 comments on commit 8116e70

Please sign in to comment.