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!