PHPUnit in a pipeline always returns 0 even with --debug flag

Hello. I did bump into a bug I can figure out. Would be glad for any help.


I have a pipeline configured like this:

# You can specify a custom docker image from Docker Hub as your build environment.
image: phpunit/phpunit:6.5.3

    - step:
        name: Testing
          - composer
          - node
          - composer build-dev
          - php --version
          - composer --version
          - phpunit --version
          - phpunit -c phpunit.xml --debug

A proper configuration phpunit.xml file that works on a local environment just fine. But when the pipeline runs phpunit always returns 0 when running the tests. Same goes for running with --testdox attribute.


Here is the phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
        <testsuite name="Unit">
            <directory suffix="Test.php">tests/Unit</directory>
        <testsuite name="Feature">
            <directory suffix="Test.php">tests/Feature</directory>

Tried everything I could imagine and (even local phpunit/phpunit docker image to debug and it behaves the same).

1 answer

1 accepted

My bad, that was the application issue and it is not related with bitbucket, pipeline or phpunit. I suppose there is no option to remove the question? If so I will at least explain what caused it. If application quit in any point of the execution for example with die() or exit() and the status is 0 (which is by default) pipeline will detect it as a success. So if you're having the same issue, just try to detect where script stops with for eg. register_shutdown_function()

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

30,127 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you