可发运分支覆盖率始终为 0.00%
Shippable Branch Coverage always 0.00%
我正在使用 Shippable CI 测试 phpunit 测试,但我的分支覆盖率总是 0.00%,而序列覆盖率是 100%。
这是我的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
这是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;
}
}
这是我的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");
}
}
我是否需要做任何额外的配置,或者 0.00% 真的正确吗?谢谢!
我问过 Shippable Support,他们说:
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.
我正在使用 Shippable CI 测试 phpunit 测试,但我的分支覆盖率总是 0.00%,而序列覆盖率是 100%。
这是我的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
这是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;
}
}
这是我的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");
}
}
我是否需要做任何额外的配置,或者 0.00% 真的正确吗?谢谢!
我问过 Shippable Support,他们说:
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.