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

chore(dev): enable condensed deprecation logging for tests #1155

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

mfn
Copy link
Collaborator

@mfn mfn commented Nov 20, 2024

Summary

Since Laravel is taking over handling of reported PHP deprecation, we need to use its infrastructure to also make them visible.

And also fix deprecated uses of faker()

This is done in light of #1152

For reference:

Example of a workflow run showing them is https://github.com/rebing/graphql-laravel/actions/runs/11934861610/job/33264909350?pr=1155

Due to using thecodingmachine/safe currently have a TON of such deprecations upfront, before the framework is even loaded.

Example of such output
Deprecated: Rebing\GraphQL\Tests\Support\Traits\MakeCommandAssertionTrait::assertMakeCommand(): Implicitly marking parameter $expectedGraphqlName as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/tests/Support/Traits/MakeCommandAssertionTrait.php on line 14
PHPUnit 10.5.38 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.0-dev
Configuration: /home/runner/work/graphql-laravel/graphql-laravel/phpunit.xml.dist

[2024-11-20 13:57:51] testing.WARNING: Rebing\GraphQL\Support\Field::authorize(): Implicitly marking parameter $resolveInfo as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/src/Support/Field.php on line 37  

[2024-11-20 13:57:51] testing.WARNING: Rebing\GraphQL\Support\Field::authorize(): Implicitly marking parameter $getSelectFields as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/src/Support/Field.php on line 0  

[2024-11-20 13:57:51] testing.WARNING: Rebing\GraphQL\Tests\Support\Objects\ExamplesAuthorizeQuery::authorize(): Implicitly marking parameter $resolveInfo as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/tests/Support/Objects/ExamplesAuthorizeQuery.php on line 18  

[2024-11-20 13:57:51] testing.WARNING: Rebing\GraphQL\Tests\Support\Objects\ExamplesAuthorizeQuery::authorize(): Implicitly marking parameter $getSelectFields as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/tests/Support/Objects/ExamplesAuthorizeQuery.php on line 18  

[2024-11-20 13:57:51] testing.WARNING: Rebing\GraphQL\Tests\Support\Objects\ExamplesAuthorizeMessageQuery::authorize(): Implicitly marking parameter $resolveInfo as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/tests/Support/Objects/ExamplesAuthorizeMessageQuery.php on line 18  

[2024-11-20 13:57:51] testing.WARNING: Rebing\GraphQL\Tests\Support\Objects\ExamplesAuthorizeMessageQuery::authorize(): Implicitly marking parameter $getSelectFields as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/tests/Support/Objects/ExamplesAuthorizeMessageQuery.php on line 18  

[2024-11-20 13:57:51] testing.WARNING: Rebing\GraphQL\Support\PaginationType::__construct(): Implicitly marking parameter $customName as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/src/Support/PaginationType.php on line 14  

D..............................................................  63 / 277 ( 22%)
............................................................... 126 / 277 ( 45%)
[2024-11-20 13:57:52] testing.WARNING: Rebing\GraphQL\Tests\Unit\ValidationAuthorizationTests\ValidationAndAuthorizationMutation::authorize(): Implicitly marking parameter $resolveInfo as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/tests/Unit/ValidationAuthorizationTests/ValidationAndAuthorizationMutation.php on line 17  

[2024-11-20 13:57:52] testing.WARNING: Rebing\GraphQL\Tests\Unit\ValidationAuthorizationTests\ValidationAndAuthorizationMutation::authorize(): Implicitly marking parameter $getSelectFields as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/tests/Unit/ValidationAuthorizationTests/ValidationAndAuthorizationMutation.php on line 17  

............................................................... 189 / 277 ( 68%)
[2024-11-20 13:57:52] testing.WARNING: Rebing\GraphQL\Tests\Database\AuthorizeArgsTests\TestAuthorizationArgsQuery::authorize(): Implicitly marking parameter $resolveInfo as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/tests/Database/AuthorizeArgsTests/TestAuthorizationArgsQuery.php on line 33  

[2024-11-20 13:57:52] testing.WARNING: Rebing\GraphQL\Tests\Database\AuthorizeArgsTests\TestAuthorizationArgsQuery::authorize(): Implicitly marking parameter $getSelectFields as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/tests/Database/AuthorizeArgsTests/TestAuthorizationArgsQuery.php on line 33  

[2024-11-20 13:57:53] testing.WARNING: Rebing\GraphQL\Support\SimplePaginationType::__construct(): Implicitly marking parameter $customName as nullable is deprecated, the explicit nullable type must be used instead in /home/runner/work/graphql-laravel/graphql-laravel/src/Support/SimplePaginationType.php on line 14  

............................................................... 252 / 277 ( 90%)
.........................                                       277 / 277 (100%)

Time: 00:03.167, Memory: 64.50 MB

1 test triggered 1 PHP deprecation:

1) /home/runner/work/graphql-laravel/graphql-laravel/vendor/voku/portable-ascii/src/voku/helper/ASCII.php:795
voku\helper\ASCII::to_ascii(): Implicitly marking parameter $replace_single_chars_only as nullable is deprecated, the explicit nullable type must be used instead

Triggered by:

* Rebing\GraphQL\Tests\Unit\AliasArguments\AliasArgumentsTest::testMutationAlias
  /home/runner/work/graphql-laravel/graphql-laravel/tests/Unit/AliasArguments/AliasArgumentsTest.php:31

OK, but there were issues!
Tests: 277, Assertions: 864, Deprecations: 1.

Such output does not negatively influence the outcome of the tests. It does make them a bit harder to read at times, but the point is to actually get rid of them 😅


Type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Misc. change (internal, infrastructure, maintenance, etc.)

Checklist:

  • Existing tests have been adapted and/or new tests have been added
  • Add a CHANGELOG.md entry
  • Update the README.md
  • Code style has been fixed via composer fix-style

@mfn mfn self-assigned this Nov 20, 2024
@mfn mfn merged commit 6caf374 into master Nov 20, 2024
46 checks passed
@mfn mfn deleted the mfn-tests-deprecation-logging branch November 20, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant