Skip to content

[PhpUnitBridge] Use verbose deprecation output for quiet types only when it reaches the threshold #48787

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

Merged
merged 1 commit into from
Dec 28, 2022

Conversation

ogizanagi
Copy link
Contributor

@ogizanagi ogizanagi commented Dec 26, 2022

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

Current

Given a configuration like:

SYMFONY_DEPRECATIONS_HELPER="max[direct]=0&max[self]=0&max[total]=999999&quiet[]=indirect

If there is any deprecation reaching the configured threshold (for instance here, a direct or self deprec),
the output contains the full verbose deprecations output, for each of the deprecation types,
despite excluding specifically the other and indirect ones by using quiet:

OK (2 tests, 18 assertions)

Remaining direct deprecation notices (6)

  4x: Since symfony/framework-bundle 5.4: Method "Symfony\Bundle\FrameworkBundle\Controller\AbstractController::get()" is deprecated, use method or constructor injection in your controller instead. 
  # […]
  # ✅ OK: Full verbose output for `direct` deprecations type

Remaining indirect deprecation notices (21)

  10x: Since symfony/http-kernel 5.3: "Symfony\Component\HttpKernel\Event\KernelEvent::isMasterRequest()" is deprecated, use "isMainRequest()" instead. 
  # […]
  # ❌ KO: Full verbose output for `indirect` deprecations type

Other deprecation notices (12)

  10x: Since symfony/cache 5.4: Usage of a DBAL Connection 
  # […]
  # ❌ KO: Full verbose output for `other` deprecations type

➜ ❌ The verbose output is used as soon as there is any deprecation failure, regardless of the type and quiet config.

Expected

Since the other and indirect deprecation types are configured as quiet and the threshold is not reached, I'd expect:

  • the direct and self deprecation types output to be verbose (whatever the threshold is)
  • the other and indirect deprecation types to be quiet (unless the threshold is reached)
OK (2 tests, 18 assertions)

Remaining direct deprecation notices (6)

  4x: Since symfony/framework-bundle 5.4: Method "Symfony\Bundle\FrameworkBundle\Controller\AbstractController::get()" is deprecated, use method or constructor injection in your controller instead. 
  # […]
  # ✅ OK: Full verbose output for `direct` deprecations type

Remaining indirect deprecation notices (21)

  # ✅ OK: No verbose output for `indirect` deprecations type, unless the threshold is reached

Other deprecation notices (12)

  # ✅ OK: NO verbose output for `other` deprecations type, unless the threshold is reached

Solution

Add a Configuration::toleratesGroup() method to use on each deprecation type to avoid using the verbose output for the type, unless it's threshold is reached or the group is not quiet.

@carsonbot carsonbot added this to the 5.4 milestone Dec 26, 2022
@ogizanagi ogizanagi force-pushed the phpunit-quiet-groups branch 2 times, most recently from ddde86b to dd05ddd Compare December 26, 2022 10:12
@OskarStark
Copy link
Contributor

Friendly ping @greg0ire, as I know you were involved in this stuff

@kbond
Copy link
Member

kbond commented Dec 26, 2022

Related to #43371?

@ogizanagi
Copy link
Contributor Author

Related to #43371?

It seems to be the same indeed

@ogizanagi ogizanagi force-pushed the phpunit-quiet-groups branch from dd05ddd to 8f3b28e Compare December 27, 2022 08:11
@ogizanagi
Copy link
Contributor Author

@kbond : I added your test case to this PR

Copy link
Contributor

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this

@nicolas-grekas
Copy link
Member

Thank you @ogizanagi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants