Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shippable Branch Coverage always 0.00% #1929

Closed
molerat619 opened this issue Oct 7, 2015 · 4 comments
Closed

Shippable Branch Coverage always 0.00% #1929

molerat619 opened this issue Oct 7, 2015 · 4 comments

Comments

@molerat619
Copy link

I am testing phpunit tests with Shippable CI but I always get 0.00% in Branch Coverage while Sequence Coverage is 100%.

This is my shippable.yml:

language: php

php: 
    - 5.4

before_script: 
    - mkdir -p shippable/testresults
    - mkdir -p shippable/codecoverage
    - mysql -e 'create database if not exists test;'

script:
  - phpunit  --log-junit shippable/testresults/junit.xml --coverage-xml shippable/codecoverage test.php

This is sql.php:

  class SQL {
      public static function main($bool) {
         $test = 5;
         $tmp = 0;

         if($bool + $test >= 10){
            $tmp = 10;
         }else{
            $tmp = 77;
         }

         if($tmp == 10){
            return true;
         }

         return false;
   }
 }

This is my test.php:

    class SQLTest extends PHPUnit_Framework_TestCase {
        public function test() {
          $sql = new SQL();
          $doc = $sql->main(3);
          $this->assertEquals(false, $doc);
        }

        public function test2() {
          $sql = new SQL();
          $doc = $sql->main(8);
          $this->assertEquals(true, $doc);
        }

        public function testBla(){
          $test = "string";
          $this -> assertEquals($test, "string");
        }
    }

Do I have to do any extra configuration or is 0.00% really correct? Thanks!

@lekhab
Copy link
Contributor

lekhab commented Oct 7, 2015

@molerat619: PHPUnit did not support branch coverage until recently, so our parser does not output branch coverage metrics for PHPUnit.
From the PHPUnit docs, it does look like they might have added support for branch coverage; will open this as a feature request internally to find out if this is now in a parseable format.

@molerat619
Copy link
Author

Ok, thank you very much

@mbrodala
Copy link

@lekhab AFAIK branch coverage is not supported by PHPUnit yet.

@manishas
Copy link
Contributor

manishas commented Mar 4, 2016

We have completely redone our test and coverage reports handling and PHP reports should be working for both. Closing this issue but please let us know if you run into problems.

@manishas manishas closed this as completed Mar 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants