Codeception / Codeception

Full-stack testing PHP framework
http://codeception.com
MIT License
4.76k stars 1.3k forks source link

Allow to config deprecations notification in codeception.yml #6493

Closed c33s closed 2 years ago

c33s commented 2 years ago

it would be awesome to have a config flag where i enable/disable the deprecation notification. currently the deprecation notifications is very spammy. i am working on a symfony 5.4 project and i get a big deprecation wall everytime. i played around with SYMFONY_DEPRECATIONS_HELPER but it somehow has no effect (also it feels quite strange to use env vars for a static value even if codeception.yml exists.

in Subscriber/ErrorHandler.php i can verify that SYMFONY_DEPRECATIONS_HELPER is set to disabled. in the registerDeprecationErrorHandler function the code doesn't pass the if because of the env var but still all notifications. if i change handleDeprecationError to simply return i get the desired result.

7x DEPRECATION: Since symfony/framework-bundle 5.4: Accessing the "profiler" service directly from the container is deprecated, use dependency injection instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-bundle 5.4: Setting the $authenticatorManagerEnabled argument of "Symfony\Bundle\SecurityBundle\DataCollector\SecurityDataCollector::__construct" to "false" is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-core 5.4: Not setting the 5th argument of "Symfony\Component\Security\Core\Authorization\AuthorizationChecker::__construct" to "false" is deprecated. vendor\symfony\deprecation-contracts\function.php:25
14x DEPRECATION: Since symfony/http-foundation 5.3: "Symfony\Component\HttpFoundation\RequestStack::getMasterRequest()" is deprecated, use "getMainRequest()" instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since sonata-project/block-bundle 4.11: The "sonata.block.cache.handler.default" service is deprecated since sonata-project/block-bundle 4.11 and will be removed in 5.0. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Passing an instance of "Sonata\BlockBundle\Cache\HttpCacheHandlerInterface" as argument 7 for method "Sonata\BlockBundle\Templating\Helper\BlockHelper::__construct" is deprecated since sonata-project/block-bundle 4.11. The argument will be removed in 5.0. vendor\sonata-project\block-bundle\src\Templating\Helper\BlockHelper.php:251
7x DEPRECATION: Since symfony/security-bundle 5.3: The ".container.private.security.password_encoder" service is deprecated, use "security.user_password_hasher" instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\UserPasswordEncoder" class is deprecated, use "Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher" instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface" interface is deprecated, use "Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface" instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-bundle 5.3: The "security.encoder_factory.generic" service is deprecated, use "security.password_hasher_factory" instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\EncoderFactory" class is deprecated, use "Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory" instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface" class is deprecated, use "Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface" instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/event-dispatcher 5.1: Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy is deprecated, use the event dispatcher without the proxy. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-bundle 5.3: The "security.authentication.listener.guard.main" service is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-guard 5.3: The "Symfony\Component\Security\Guard\Firewall\GuardAuthenticationListener" class is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-bundle 5.3: The "security.authentication.guard_handler" service is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-guard 5.3: The "Symfony\Component\Security\Guard\GuardAuthenticatorHandler" class is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-bundle 5.3: The "security.authentication.manager" service is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager" class is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Event\AuthenticationFailureEvent" class is deprecated, use "Symfony\Component\Security\Http\Event\LoginFailureEvent" with the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-bundle 5.3: The "security.authentication.listener.anonymous.main" service is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-http 5.3: The "Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener" class is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-http 5.4: The $authManager argument of "Symfony\Component\Security\Http\Firewall\AccessListener::__construct" is deprecated. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-http 5.4: Not setting the $exceptionOnNoToken argument of "Symfony\Component\Security\Http\Firewall\AccessListener::__construct" to "false" is deprecated. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/framework-bundle 5.3: The "session.storage.factory.service" service is deprecated, use "session.storage.factory.native", "session.storage.factory.php_bridge" or "session.storage.factory.mock_file" instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/framework-bundle 5.3: The "session.storage.mock_file" service is deprecated, use "session.storage.factory.mock_file" instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/framework-bundle 5.3: The "session.storage.metadata_bag" service is deprecated, create your own "session.storage.factory" instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-core 5.4: The "Symfony\Component\Security\Core\Authentication\Token\AnonymousToken" class is deprecated. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-core 5.4: Using an object that is not an instance of "Symfony\Component\Security\Core\User\UserInterface" as $user in "Symfony\Component\Security\Core\Authentication\Token\AnonymousToken" is deprecated. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-bundle 5.3: The "security.authentication.provider.guard.main" service is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-guard 5.3: The "Symfony\Component\Security\Guard\Provider\GuardAuthenticationProvider" class is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface" interface is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
7x DEPRECATION: Since symfony/security-bundle 5.3: The "security.authentication.provider.anonymous.main" service is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/security-core 5.3: The "Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider" class is deprecated, use the new authenticator system instead. vendor\symfony\deprecation-contracts\function.php:25
16x DEPRECATION: Since symfony/security-bundle 5.4: The "Symfony\Bundle\SecurityBundle\Security\FirewallConfig::allowsAnonymous()" method is deprecated. vendor\symfony\deprecation-contracts\function.php:25
6x DEPRECATION: Since league/commonmark 2.2.0: Calling "convertToHtml()" on a League\CommonMark\MarkdownConverter class is deprecated, use "convert()" instead. vendor\symfony\deprecation-contracts\function.php:25
2x DEPRECATION: Since symfony/framework-bundle 5.1: Using type "Symfony\Component\Routing\RouteCollectionBuilder" for argument 1 of method "App\SymfonyKernel:configureRoutes()" is deprecated, use "Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator" instead. vendor\symfony\deprecation-contracts\function.php:25
DEPRECATION: Since symfony/routing 5.1: The "Symfony\Component\Routing\RouteCollectionBuilder" class is deprecated, use "Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator" instead. vendor\symfony\deprecation-contracts\function.php:25
phpunit/php-code-coverage 7.0.15 Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator 2.0.5  FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template 1.2.1  Simple template engine.
phpunit/php-timer         2.1.3  Utility class for timing
phpunit/php-token-stream  4.0.4  Wrapper around PHP's tokenizer extension.
phpunit/phpunit           8.5.13 The PHP Unit Testing framework.
codeception/codeception       4.1.31 BDD-style testing framework
codeception/lib-asserts       1.13.2 Assertion methods used by Codeception core and Asserts module
codeception/lib-innerbrowser  1.5.1  Parent library for all Codeception framework modules and PhpBrowser
codeception/module-asserts    1.3.1  Codeception module containing various assertions
codeception/module-db         1.2.0  DB module for Codeception
codeception/module-doctrine2  1.1.1  Doctrine2 module for Codeception
codeception/module-filesystem 1.0.3  Codeception module for testing local filesystem
codeception/module-phpbrowser 1.0.2  Codeception module for testing web application over HTTP
codeception/module-rest       1.4.2  REST module for Codeception
codeception/module-sequence   1.0.1  Sequence module for Codeception
codeception/module-symfony    1.1.1  Codeception module for Symfony framework
codeception/module-webdriver  1.4.0  WebDriver module for Codeception
codeception/phpunit-wrapper   8.1.4  PHPUnit classes used by Codeception
codeception/stub              4.0.2  Flexible Stub wrapper for PHPUnit's Mock Builder

Details

Naktibalda commented 2 years ago

Setting appropriate error_level setting in codeception.yml should help.

settings:
    error_level: E_ALL & ~E_STRICT & ~E_DEPRECATED & ~E_USER_DEPRECATED

Documentation: https://codeception.com/docs/04-FunctionalTests#Error-Reporting

c33s commented 2 years ago

as i mostly searched for "disable deprecation notification" in the issues on github and on search engines, maybe adding the wording "remove/silence/disable deprecation warnings" to the doc section could help.