Skip to content

test: Use PHPUnit attributes for Kirby\Http #7207

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

Draft
wants to merge 1 commit into
base: v5/develop
Choose a base branch
from

Conversation

distantnative
Copy link
Member

@distantnative distantnative commented May 11, 2025

Description

Summary of changes

  • Use CoversClass and DataProvider PHPUnit attributes instead of DocBlock annotations in the Kirby\Http package

Reasoning

Switching over package by package (or smaller units) to see how the code coverage is affected.

Additional context

Put this for the 5.1.0 milestone to not further add to the list of the 5.0.0 milestone as we want to close this very soon.

The changes were mostly created automatically with Rector:

<?php

declare(strict_types = 1);

use Rector\Config\RectorConfig;
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\CoversAnnotationWithValueToAttributeRector;
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;

return RectorConfig::configure()
	->withImportNames()
	->withPaths([
		__DIR__ . '/tests/Http',
	])
	->withRules([
		CoversAnnotationWithValueToAttributeRector::class,
		DataProviderAnnotationToAttributeRector::class,
		AddVoidReturnTypeWhereNoReturnRector::class
	]);

Only a few rare attributes (#[RunInSeparateProcess], #[PreserveGlobalState(false)]) were changed manually based on PHPUnit deprecation warnings.

Ready?

  • In-code documentation (wherever needed)
  • Unit tests for fixed bug/feature
  • Tests and CI checks all pass

@distantnative distantnative added this to the 5.1.0 milestone May 11, 2025
@distantnative distantnative self-assigned this May 11, 2025
@distantnative distantnative force-pushed the v51/test/http-pkg-phpunit-attributes branch from 7c87582 to 4b555d8 Compare May 11, 2025 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant