I Can't get into sonarcloud coverage 0.0%

hi,
I use php without framework
Integrates Bitbucket and Sonarcloud
I can’t activate coverage in sonarcloud. I need help.

I did it as follows:
bitbucket-pipeline.yaml

image: php:8.2.7

clone:
  depth: full

definitions:
  services:
    docker:
      memory: 3072
  caches:
    sonar: ~/.sonar/cache
  steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        caches:
          - docker
          - sonar
        size: 2x
        script:
          - echo "Manual triggers for Sonar are awesome!"
          - apt-get update
          - install xdebug 
          - install composer
          - composer require phpunit/phpunit
          - vendor/bin/phpunit
          - php -n -dzend_extension=xdebug -dxdebug.mode=coverage vendor/bin/phpunit --log-junit test-reports/junit.xml 
          
          - pipe: sonarsource/sonarcloud-scan:2.0.0
            variables:
              SONAR_TOKEN: ${VARIABLETOKEN}
              DEBUG: 'false'
              EXTRA_ARGS:    
                            - sonar-scanner -Dsonar.projectKey=$VARIABLEKEY
                            -Dsonar.organization=$VARIABLEORG
                            -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io
                            -Dsonar.login=$VARIABLETOKEN
                            -Dsonar.php.lcov.reportPaths=coverage/lcov.info -X
                            -Dsonar.coverage.exclusions=**/tests/Unit//**/*.*
        artifacts: 
          - test-reports/junit.xml -coverage.txt      
    - step: &check-quality-gate-sonarcloud
        name: Check the Quality Gate on SonarCloud
        size: 2x # Double resources available for this step.
        script:
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.4
            variables:
              SONAR_TOKEN: ${VARIABLEORG}
              SONAR_QUALITY_GATE_TIMEOUT: '180'
pipelines:
   custom:
     sonar-scan:
       - step: *build-test-sonarcloud
     sonar-quality:
       - step: *check-quality-gate-sonarcloud
[...]

phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" stopOnFailure="false" >
  <testsuites>
    <testsuite name="default">
      <directory>tests/Unit/</directory>
    </testsuite>
  </testsuites>
  <coverage>
    <include>
      <directory suffix=".php">src</directory>
    </include>
    <exclude>
[...]
    </exclude>
    <report>
      <xml outputDirectory="test-reports"/>
    </report>
  </coverage>
  <php>
    <ini name="xdebug.mode" value="coverage"/>
   [...]
  </php>
  <logging>
    <junit outputFile="test-reports/junit.xml"/>
  </logging>
</phpunit>

What do the logs about importing coverage say?

Good afternoon Colin.
I’ll check and do some tests and let you know

I did several tests following the suggestions but I was unsuccessful. I really need help!

That’s fine – but the the link I showed you is how to look for the logs to share here so others might be able to help. Nobody can do much with “I did several tests” – we need examples and logs!

I very confused! From what I read and understood it would be this:


Setting it this way:
-Dsonar.php.lcov.reportPaths=coverage/lcov.info -X

Hi,

Screenshots of logs are really hard to read and, in this case, incomplete.

Please copy/paste the full text of your analysis log, starting from the analysis command.

 
Ann