我正在使用 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% 真的正确?谢谢!