Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Artur Stępień January 11, 2018

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

pipelines:
  default:
    - step:
        name: Testing
        caches:
          - composer
          - node
        script:
          - 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"?>
<phpunit
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="phpunit.xsd"
         bootstrap="tests/bootstrap.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="true"
         verbose="true"
         defaultTestSuite="Unit"
    >
    <testsuites>
        <testsuite name="Unit">
            <directory suffix="Test.php">tests/Unit</directory>
        </testsuite>
        <testsuite name="Feature">
            <directory suffix="Test.php">tests/Feature</directory>
        </testsuite>
    </testsuites>
</phpunit>

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

1 answer

1 accepted

1 vote
Answer accepted
Artur Stępień January 12, 2018 edited

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
TAGS
atlassian, compass, developer experience, devex, platform engineering, internal developer platform, component catalog, atlassian learning, productivity tools, developer productivity, software architecture, compass webinar, engineering teams

Discover how Compass drives DevEx and productivity at Atlassian 🏃🏻‍♂️

Learn why Compass was built to tackle dev experience at scale. See how Atlassian uses it to boost visibility, reduce cognitive load, and drive consistency—plus tips to get started and customize your IDP for stronger team engagement.

Join the webinar ✨
AUG Leaders

Atlassian Community Events