Phpunit: Exit code changed since 5.7.7

Created on 26 Jan 2017  ·  4Comments  ·  Source: sebastianbergmann/phpunit

All the builds in our org projects are failing because we keep using getMock() until we drop phpunit 4, but run them with phpunit 5. Not very clever, I know, but since yesterday, the previously harmless warnings triggered by getMock() make the build fail because it seems the exit code is no longer 0. This looks like a BC-break, are you going to revert it or is it deliberate?

typbackward-compatibility

Most helpful comment

The only change in PHPUnit 5.7.7 that I can think of that would be causing this is #2349 / f4cf4d14139ee81da3da487a5d21e92d78aa0f69.

I believe that exiting with a return code that signals "not successful" is the right thing to do when there are warnings. I will revert PHPUnit 5.7 to not signal "not successful" when there are warnings. But I will leave this change in PHPUnit 6.0.

All 4 comments

Same problem in our build chain, downgraded to 5.7.6 this morning...

Same thing, seems critical.

The only change in PHPUnit 5.7.7 that I can think of that would be causing this is #2349 / f4cf4d14139ee81da3da487a5d21e92d78aa0f69.

I believe that exiting with a return code that signals "not successful" is the right thing to do when there are warnings. I will revert PHPUnit 5.7 to not signal "not successful" when there are warnings. But I will leave this change in PHPUnit 6.0.

I can reproduce this issue:

<?php
class Test extends PHPUnit_Framework_TestCase
{
    public function testOne()
    {
        throw new PHPUnit_Framework_Warning;
    }
}

PHPUnit 5.7.6

$ phpunit Test
PHPUnit 5.7.6 by Sebastian Bergmann and contributors.

W                                                                   1 / 1 (100%)

Time: 39 ms, Memory: 4.00MB

There was 1 warning:

1) Test::testOne

/home/sb/Test.php:6

WARNINGS!
Tests: 1, Assertions: 0, Warnings: 1.
$ echo $?                  
0



md5-54ac7ec8c06202fb0f99ca866634ce8a



$ phpunit Test
PHPUnit 5.7.7 by Sebastian Bergmann and contributors.

W                                                                   1 / 1 (100%)

Time: 33 ms, Memory: 4.00MB

There was 1 warning:

1) Test::testOne

/home/sb/Test.php:6

WARNINGS!
Tests: 1, Assertions: 0, Warnings: 1.



md5-9d7edb403002be9deaf3a0fffff5ad08



$ echo $?
1
Was this page helpful?
0 / 5 - 0 ratings