Codeception: No-exit Option is ignored when deprecation warnings happen.

Created on 8 Jun 2017  Â·  10Comments  Â·  Source: Codeception/Codeception

What are you trying to achieve?

I ran codeception using jenkins, the tests pass AND I am using the --no-exit option, so the exit code should be 0.

What do you get instead?

but the exit code is 1, leading to a failed build. Reason seems to be the deprecation notices - because if I remove this module from my acceptance.suite.yml

        - Doctrine2:
            depends: Symfony
            populate: true
            cleanup: true

deprecation notice and exit code get back to normal.
(Without this deprecation notices I get the exit code of 1 only when I omit the --no-exit option AND have at least one failing test. As it should be.)

This is the end of the output of the test run:

Time: 8.92 seconds, Memory: 32.00MB

OK (3 tests, 7 assertions)

Remaining deprecation notices (6)

Setting the "doctrine" pre-defined service is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0: 3x
    3x in Application::run from Codeception

Setting the "doctrine.orm.default_entity_manager" pre-defined service is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0: 3x
    3x in Application::run from Codeception

Details

  • Codeception version: 2.2.3
  • PHP Version: 7.1.5
  • Operating System: Windows 7
  • Installation type: Composer
  • Suite configuration:
class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: http://localhost/reactex/web/app.php
        - \Helper\Acceptance
        - Doctrine2:
            depends: Symfony
            populate: true
            cleanup: true
        - REST:
            url: /
            depends: PhpBrowser
            part: Json
    config:
        - Symfony:
            var_path: 'var'
            app_path: 'app'

Most helpful comment

SYMFONY_DEPRECATIONS_HELPER=disabled codecept run

All 10 comments

Sorry for interrupting

Setting the "doctrine" pre-defined service is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0
Setting the "doctrine.orm.default_entity_manager" pre-defined service is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0

@DavertMik This change will kill Doctrine module when Symfony 4.0 comes out, won't it?

@OwnerOfThisIsle Your output doesn't look like deprecation output produced by Codeception.

Here is an example of what I got when I ran codecept run tests/unit/Codeception/Module/PhpBrowserTest.php:

✔ PhpBrowserTest: Form with files array (0.05s)
✔ PhpBrowserTest: Submit form (0.03s)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
34x DEPRECATION: PHPUnit\Framework\TestCase::setExpectedException deprecated in favor of expectException, expectExceptionMessage, and expectExceptionCode


Time: 9.85 seconds, Memory: 22.00MB

OK (212 tests, 479 assertions)
gintas@gintas-laptop:~/workspace/codeception$ echo $?
0

Deprecation messages are printed above Time and Summary, not below like in your case.

Your output looks like the output produced by symfony/phpunit-bridge
Example of output is here.

Exit(1) is here.

@OwnerOfThisIsle Uninstall symfony/phpunit-bridge completely or disable the deprecation helper.

Thx for pointing in the right direction, but one more question arose:
The PHP UnitBridge can be configured using an Environment Var named SYMFONY_DEPRECATIONS_HELPER, in their docs they describe how to set this var using the phpunit.xml.

Since codeception does not use phpunit.xml I need to know how I could set an environment variable using codeception config.

SYMFONY_DEPRECATIONS_HELPER=disabled codecept run

Hi, I tried a few things around your suggestion, but I couldn't make it work:

SYMFONY_DEPRECATIONS_HELPER=disabled codecept run

is not working for me, maybe because I am on windows?

I also tried

set SYMFONY_DEPRECATIONS_HELPER=disabled
codecept run

and I defined a windows environment variable SYMFONY_DEPRECATIONS_HELPER, set to 'disabled'
but the deprecation notice keep appearing.

I noticed that you use an old version of Codeception.
What version of symfony/phpunit-bridge have you got installed? disabled option is supported since version 3.1.0.

Maybe I had a typo in the version number or I updated in the meantime.

Currently codeception is version 2.2.9,
phpunit-bridge is version 3.3.2

Do you run it in cmd.exe or in PowerShell?

this is wrong
set SYMFONY_DEPRECATIONS_HELPER=disabled codecept run

this is the proper way
export SYMFONY_DEPRECATIONS_HELPER=disabled codecept run

Was this page helpful?
0 / 5 - 0 ratings