Web??PHP?????????????????????
???????????? ???????[ 2015/12/8 14:17:27 ] ???????????????
????1. ??????????????
?????????????????к?????Σ??????и??????????/??????????????????????????????????????????????????????????????????????в??????????????????????????????????????????????????д??????????????????????Щ??????????缸?????????????????????????????????????????????????????PHP??????????PHPUnit??Spike PHPCoverage??????????xdebug???????????????????????У????????????????????????????????????????PHP????????????????????????
????2. ?????
???????????????????????????????????????????????й?????????????????????????????????£???????????????????????????????????????????й??????????飬?????Щ?????????????????????????????????е????????????????????????????????????????????????????????????????????????д?????д?????????????????Щ???????????????????2?????????????????в?????Щ??????????????????????????????????
?????????????????xdebug??????????????????????????????????£?
????xdebug_start_code_coverage(); //???????????и??????
????xdebug_get_code_coverage(); //???????????????????????????к?
????xdebug_stop_code_coverage(); //??????????и??????
????xdebug?????????????????и?????????????????????????????и???????????е???????????У????????????????????????????磬??β???????????A.php??????10?У????????ж?A.php?????????????A.php??9?к??10?????????????д??????????????10?б?????12?У???xdebug???и?????????????к?……??????????????????????????????????????????ú??????????????????????????????????У??????д???????????????????????????xdebug???????????????????
?????????????????????????????
??????1?????????β???????????????к????б???????????????ж??????????????????????????????
??????2???????????????????????????棬????????????????????
??????3??????????????????£?
???????в??????????????????????Щ?????????
????3. ????????????????
??????1?????
????xdebug??????????и???????????????????????????????????????????????????????????????Щ????????У???????????????ж??????????
??????????????????????????????????????к??????????飬??????????????????????????????????C++????Java?У???????????????????????????????????PHP???????????????????????????PHP4.3?????PHP Zend Engine????????tokenizer???????????????????????????????????????PHP?ж??庯??????????????????????????????PHP????е???????????
????tokenizer??????????????
????array token_get_all (string $source)
?????ú??????????????????php?????????token???????顣
????string token_name (int $token)
???????????????token????????????????????C?????е?strerror??????????tokenizer??????????php???????????????????????????????????????????????????????????????д???????a????????????ó????????????ο???PHPFunctionParser
???????????????????????????????????е?????б?????????????????Щ??·?????????????????????????xdebug?????????У?????????к???????????????????????????????ε??????????к?????????????????????????????1000?У????????1000???ж??Ч???????????????????????xdebug????function trace???????????????????е???????ù?????????????????????????????????????????????????????ε??????????????Reflection?????????????????????????????????????????ж??塣???????????function trace????????ù?????????????????У?????????????????????е???????????????????????“????::??????”??????????????reflection???????????????????????????ɡ??????????????????????????????
??????2?????
????????????????????????????????PHP???????á?xdebug??????????????????xdebug_start_code_coverage??xdebug_stop_code_coverage????????????????????????????????????????????????????????????????xdebug_stop_code_coverage???register_shutdown_function????php??????????????????γ???????C?????atexit???????????????????????У???????????????require?????????ɡ???????PHP?????CodeIgniter??????????????????????index.php???????????????????????????????????????е??????????????????????е?PHP?????????????index.php???????????????????
??????????????????????????index.php?????м???????仰??
????<?php require_once "/file/path/to/phpcoverage.php"; ?>
??????phpcoverage.php?????????????????£?
<?php
……
function xdebugPhpcoverageBeforeShutdown(){
……
$lineCovData = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
……
xdebug_stop_trace();
……
}
register_shutdown_function(‘xdebugPhpcoverageBeforeShutdown’);
……
xdebug_start_trace(……);
xdebug_start_code_coverage();
????//???????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11