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

hiding Symfony 4.3 deprecation warning #5555

Merged
merged 1 commit into from Jun 19, 2019
Merged

Conversation

DavertMik
Copy link
Member

Let's hide this annoying message as this has no deal to Codeception users

@Naktibalda Naktibalda merged commit 65ffe3b into 3.0 Jun 19, 2019
@Naktibalda Naktibalda deleted the fix-symfony-deprecate branch June 19, 2019 11:04
@s1mple
Copy link

s1mple commented Jun 19, 2019

Wow, thank you so much! This was annoying me so much, and now you fixed it. 🙇

@DanielRuf
Copy link
Contributor

No difference. I guess it affects the whole Codeception framework. See https://github.com/Codeception/Codeception/search?q=dispatch%28&unscoped_q=dispatch%28

@Naktibalda
Copy link
Member

@DanielRuf This change hadn't been release yet.
Also I noticed that you use Codeception v2 which won't be patched.

@DanielRuf
Copy link
Contributor

Also I noticed that you use Codeception v2 which won't be patched.

Sure but we tried it and it definitely does not fix the regression caused by symfony/event-dispatcher > 4.2.8.

@fernandojmartin
Copy link

fernandojmartin commented Dec 30, 2019

I'm on version 4 and still got that annoying message: one per test.
Am I doing anything wrong?

$ composer require codeception/codeception --dev
Using version ^4.0 for codeception/codeception
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class

$ php vendor/bin/codecept init upgrade4
 Welcome to Codeception v4 Upgrade wizard!

Codeception is maintained since 2011, is free & open-source.
To make it better we need your feedback on it!

Please take a minute and fill in a brief survey:
http://bit.ly/codecept-survey

? Did you fill in the survey? (y/n) y
Thank you! 
 No upgrade needed! Everything is fine already 

$ composer show (just the relevant parts)

codeception/codeception             4.0.1              BDD-style testing framework
codeception/lib-asserts             1.1.1              Assertion methods used by Codeception core and Asserts module
codeception/lib-innerbrowser        1.2.3              Parent library for all Codeception framework modules and PhpBrowser
codeception/module-asserts          1.1.1              Codeception module containing various assertions
codeception/module-db               1.0.1              WebDriver module for Codeception
codeception/module-phpbrowser       1.0.0              Codeception module for testing web application over HTTP
codeception/module-rest             1.0.0              REST module for Codeception
codeception/phpunit-wrapper         7.8.0              PHPUnit classes used by Codeception
codeception/stub                    3.0.0              Flexible Stub wrapper for PHPUnit's Mock Builder
...
...
symfony/browser-kit                 v5.0.2             Symfony BrowserKit Component
symfony/cache                       v4.3.4             Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts             v1.1.5             Generic abstractions related to caching
symfony/config                      v4.3.4             Symfony Config Component
symfony/console                     v4.3.3             Symfony Console Component
symfony/debug                       v4.3.4             Symfony Debug Component
symfony/dependency-injection        v4.3.4             Symfony DependencyInjection Component
symfony/dotenv                      v4.3.4             Registers environment variables from a .env file
symfony/event-dispatcher            v4.3.4             Symfony EventDispatcher Component
symfony/event-dispatcher-contracts  v1.1.5             Generic abstractions related to dispatching event
symfony/framework-bundle            v4.3.4             Symfony FrameworkBundle
symfony/http-client                 v5.0.2             Symfony HttpClient component
symfony/http-client-contracts       v2.0.1             Generic abstractions related to HTTP clients
symfony/http-foundation             v4.3.4             Symfony HttpFoundation Component
symfony/http-kernel                 v4.3.4             Symfony HttpKernel Component
...
symfony/process                     v4.3.4             Symfony Process Component
symfony/property-access             v4.3.4             Symfony PropertyAccess Component
symfony/routing                     v4.3.4             Symfony Routing Component
symfony/service-contracts           v1.1.6             Generic abstractions related to writing services

@Naktibalda
Copy link
Member

Which message?

The only odd thing about your dependencies is that you use 5.0 of browser-kit and http-client, but 4.3 version of other Symfony components. Can you upgrade them to 5.0?

@fernandojmartin
Copy link

Thanks for the quick response!

The message:

...
Time: 588 ms, Memory: 16.00 MB

OK (3 tests, 6 assertions)
{
    "statusCode": 500,
    "errors": [
        {
            "type": "SERVER_ERROR",
            "description": "ERROR: Calling the \"Symfony\\Component\\EventDispatcher\\EventDispatcherInterface::dispatch()\" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead. on line 58 in file \{...}\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php."
        }
    ]
}{
    "statusCode": 500,
    "errors": [
...

I'm unsure about upgrading as dispatch() is used in many places in the project. Should check with other devs if an upgrade doesn't brakes anything else.
However I see it should be fixed the annoying message thing. I don't know what could be failing.

Should I downgrade browser-kit and http-client ?

@Naktibalda
Copy link
Member

I have no idea how you get that JSON after OK line.

If all you want is to hide deprecation messages, lookup how to set Symfony PHPUnit bridge environment variable and set it to 'weak'.

@Naktibalda
Copy link
Member

You can use SYMFONY_DEPRECATIONS_HELPER=weak codecept run functional or

export SYMFONY_DEPRECATIONS_HELPER=weak
codecept run functional

weak and disabled values are documented at https://symfony.com/doc/4.2/components/phpunit_bridge.html#making-tests-fail

These values still work with 4.3, but phpunit-bridge deprecation helper became much more configurable (and complicated) in 4.3: https://symfony.com/doc/4.3/components/phpunit_bridge.html#making-tests-fail

@fernandojmartin
Copy link

Thanks Gintautas for your support.

Unfortunately the message is still there.
I tried with Birdge 5.0, 4.4.2, then 4.3.0 and got an incompatibility with other packages when trying to go to 4.2.
The error message only changes when I forcedly set an unknown value in the config.

I'll evaluate upgrading EventDispatcher.

Thanks anyway.

@fernandojmartin
Copy link

Hey Gintautas, I'm back.
Forget about the DEPRECATIONS HELPER.

I wanted to show you this; it's a trace from the error in Symfony's EventDispatcher:57 (in the place the error is thrown)

Symfony\Component\EventDispatcher\EventDispatcher->dispatch > .../vendor/codeception/phpunit-wrapper/src/DispatcherWrapper.php:25
Codeception\PHPUnit\ResultPrinter\UI->dispatch  > .../vendor/codeception/phpunit-wrapper/src/ResultPrinter/UI.php:32
Codeception\PHPUnit\ResultPrinter\UI->printDefect  > .../vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php:345

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.

None yet

5 participants