½ñÌiÎҾ;Í×Ô¼º¶ÔXDebugʹÓõÄÒ»Ð(C)ÌaÑe×oһС¶ÎÖÏi¡£XDebugÒ²ÊÇÒoΪÐeÒªÊÇÓÃÀ´Éu³É¸²¸ÇÂÊÖÎoÎļþ²Å°²×°µÄ£¬¸Õ½Ó´¥²»¾Ã£¬Æ½Ê±ÓõÄÒ²²»ÊǺÜƵ±£¬µ«ÊÇÕa¸oµÄÈÊÇÒ»¸oºÃ¹¤¾ß£¬Èç¹uÏeÒªÒÀÀµËuÀ´*ÖÎo³ÌÐoµÄÐÔÄÜ»¹ÊÇÐeÒª×Ô¼ºÇ×ÊÖÈ¥ÊÔÊÔ¡£¾ßÌaËuÓжaºÃ£¬ÇeÌýÎÒÒ»Ò»µÀÀ´¡£
**Ò»¡¢****°²×°Æª****(XDebug ****ºÍ****PHPUnit)**A**£º°²×°**XDebug:
XdebugÍøÏÂÔØxdebug dllÎļþ£¬´ae*ŵ½php¼ÓÔصÄextĿ¼Ï£¨¿ÉÒÔÑ¡ÔñÖØÃuÃu£¬±ÈÈçphp_xdebug.dll,È»ºo´o¿ªphp.iniÎļþ£¬Ìi¼ÓÅaÖÃ
[xdebug]
zend_extension_ts = php_xdebug.dll
xdebug.profiler_enable = on
xdebug.trace_output_dir = D:\PHPAPP\XDebug
xdebug.profiler_output_dir=D:\PHPAPP\XDebug
xdebugÐeÒª²ÉÓÃzendÒýÇae¼ÓÔصĽʽ¼ÓÔØ£¬ËuÒÔÓÃzend_extension_ts»oÊÇzend_extension, tsÊÇthread_safety, Ä¿Ç°5.3ÒÔÉϲÅÖ§³Özend_extension¼ÓÔØ£¬<5.3µÄÓÃzend_extension_ts¼ÓÔØ£¨»oÕßÄa¿ÉÒÔ²e¿´phpinfoÊÇñÆoÓÃÁËzts£(C)£¬È»ºoÖØÆoapache,²e¿´phpinfo,¾Í*¢ÏÖXDebugÑ¡ÏiÁË¡£
¿ÉÒÔ¿´µ½xdebug.profiler_enable**£¬xdebug.profiler_output_dir£¬**xdebug.trace_output_dirÕaÈý¸oÊÇÎÒÃǸոÕÅaÖõÄÏi£¬¿ÉÒÔ°²×°×Ô¼ºµÄÐeÒªÅaÖÃÊ£ÓaÏi£¬xdebug.profiler_enable**£º¿ªÆoÐÔÄÜ*ÖÎo£¬**
¿ªÆoÕa¸oÖ®ºo»aÔÚxdebug.profiler_output_dirÕa¸oĿ¼ÏÂÉu³Écachegrind.out.XXXµÄÖÎoÎļþ£¬Èç¹uÖ¸¶¨ÁËxdebug.profiler_output_nameÕa¸o£¬ÔoÊa³oÀ´µÄÎļþ¾Í»aÊÇÖ¸¶¨µÄÃu×Ö.xxxµÄ¸ñʽ£¨´Ë½¨²»ÊʺÏÖÎo£¬ÔÒoÉÔºo˵Ã÷£(C)£¬
xdebug.trace_options**£ºÕa¸oÊÇ¿ªÆo¸u×ÙÏi£¬**
¿ªÆo¸ÃÏiÖ®ºo£¬»aÔÚxdebug.trace_output_dirÏÂÉu²u¸u×ÙÎļþ£¬×¢Òa¸ÃÏi»aÓ°ÏiÔËÐÐËٶȣ¬ÒoΪËuÐeÒª¼Ç¼¸u×Ù¹ý³ÌÖеÄһϵÁÐʼþ¡£****
**¹ØÓÚXDebug»¹ÓÐÒ»µaÐeҪעÒaµÄ£ºXDebugÊǵ÷ÊԵģ¬Ò²¾ÍÊÇ˵ÅaÖÃÁËXDebugÄdzÌÐoÔËÐеľÍÊÇÒ»¸oDebug״̬£¬ËuÒÔÕaʱºozend_optimizer¾Í²»ÄÜÓÃÁË£¬×ܲ»ÄÜÈóÌÐo¼´µ÷ÊÔ״̬ÓÖ´¦ÓÚÓÅ»¯×´Ì¬¹þ¡£**
**¸u¶a¹ØÓÚXDebugµÄ£¬´o¼ÒÈ¥ÍøÉÏ*¢¾o°É~~È»ºoÒ»Æð̽ÌÖ¹þ**
ÓÑÇeÌaÐÑ£º¶ÔÓÚʹÓü¯³É»*¾³µÄͬѧ£¬±ÈÈçWamp,ËuÓµÓÐÁ½¸oPHP.iniÅaÖÃÎļþ£¬Ò»¸oÔÚApacheÏ£¬Ò»¸oÔÚPHPÏ£¬ApacheÏÂÊÇÓ°ÏiwebµÄ£¬¶ø£Ð£È£ÐÏÂÊÇÓ°ÏiÃuÁiÐеģ¬ËuÒÔ¡¤¡¤¡¤¡¤£¨¸Ðл¿¡¸çµÄÌaÐÑ£(C)
B**£º°²×°**PHPUnit:
¹ØÓÚPHPUnitµÄ°²×°¹ý³Ì£¬ÍøÉÏÒ²ÒѾºÜ¶aÁË£¬Ö®Ç°×Ô¼ºÎªÁËÖÕÓÚ°²×°³É¹¦Ö®ºoҲСдÁËƪ°²×°Æª(http://user.qzone.qq.com/414073277/blog/1292122868)£¬ËuÒÔÕaÀi¾Í²»ÔÙ׸ÊoÁË£¬ÍøÉϵÄÒ»Ð(C)°²×°½Ì³Ì´o¶¼ÄÜÍe³É°²×°¡£¾Í¼oµ¥ËµÏ¹ý³Ì£º
PHPUnit°²×°ÓõÄÊÇpearµÄ°²×°½Ê½£¬ËuÒÔÈç¹u»u×ÓûÓа²×°¹ýpear°uÐeÒªÏÈ°²×°Ï£¬Ò»°aÔÚphp°²×°µÄʱºoÔÚÆa°²×°Ä¿Â¼Ï¶¼ÓÐÒ»¸ogo-pear.batÎļþ£¬Ö±½ÓÖ´Ðм´¿ÉÍe³É°²×°£¬¡¾ÕaÀi°²×°ÐeҪעÒaÀ(C)Õ¹exif£¬Õa¸oÀ(C)Õ¹»aÓõ½mbstringÀ(C)Õ¹ÖеĽ*¨£¬ËuÒÔmbstringµÄ¼ÓÔØ˳ÐoÐeÒªÔÙexifÖ®ÉÏ¡£¡¿Íe³ÉpearµÄ°²×°Ö®ºo¾Í¿ÉÒÔÖ´ÐÐpear£¬²e¿´pearµÄÃuÁi²ÎÊý£¬
È»ºoÒÀ´ÎÖ´ÐÐ:
pear channel-discover pear.phpunit.de
pear install ¨Calldeps phpunit/PHPUnit
ÐeҪעÒaµÄÊÇÏÖÔÚ×iаaeµÄphpunitÊÇ3.5µÄ¡¤¡¤µ«ÊÇÕa¸oÖ»ÓÐpearµÄ°ae±¾ÊÇ1.6ÒÔÉϼ°PHP5.2.X²Å»a°²×°µÃµ½×iаae¡¤*ñÔoÊÇ°²×°µÄÊǵÚÒ»´ÎµÄ°ae±¾£¨²»¹ý²»Ó°ÏiʹÓã(C)¡£
°²×°ºÃºo¾Í¿ÉÒÔÖ´ÐÐphpunit²e¿´Ïa¹ØÐÅÏ¢:
¿ÉÒÔ¿´µ½ÓСªcoverage-html ¨Ccoverage-clover ¨Ccoverage-sourceÕaÈý¸oÑ¡Ïi¡¤¾ÍÊÇÒoΪÔÚXDebug°²×°³É¹¦Ö®ºo²ÅÄÜÓã¬ÕaÈý¸o¶ÔÓÚµ¼³o¸²¸ÇÂÊÎļþ¿ÉÊǺÜÖØÒªµÄÑ¡Ïi¡£
**¶þ¡¢****PHPUnit ****µ¥Ôª²aÊÔ¸²¸ÇÂÊ*ÖÎo******µ¥Ôª²aÊÔ£¬×iÖØÒªµÄÖ¸±eÖ®Ò»¾ÍÊǸ²¸ÇÂÊ¡£ÕaµaËaÈ»Zend StudioÉÏ¿ÉÒÔºÜÇaÎuµÄ¿´³oÀ´£¬¿ÉÊÇÒªµ¼³o³ÉÒ»*ÖÎĵµ¾Í²»Ì«ºÃʹÁË£¬ËuÒÔÕaʱºoXDebug¾ÍÓÖ¿ÉÒÔ°iÉÏæÁË£¬Ê¹ÓõÄʱºoҲͦ¼oµ¥£¬µ÷ÓÃÃuÁi¼´¿É:
phpunit ¨Ccoverage-html D:\PHPAPP\XDebug\ YouTest
ÕaÑu¾Í»a½«Éu³ÉµÄ¸²¸ÇÎļþ£¨html¸ñʽµÄ£(C)*ÅÔÚD:\PHPAPP\XDebug\Ŀ¼ÏÂÁË£¬
È»ºo¾Í¿ÉÒÔÔÚ*ÅÖõÄĿ¼ÏÂÕÒµ½Ò»¶ÑµÄhtmlÎļþ£¬ÔËÐÐÏÂindex.html
¾Í¿ÉÒÔ¿´µ½ÕaÑuµÄͼÁË£¬Ó¢ÎÄ×ÖĸºÜ¼oµ¥¡¤¡¤Òa˼ҲÃ÷Á˾Ͳ»½aÊÍÁË£¬ËµÃ÷Ò»µa£º
²aÊÔ½a¹u˵Ã÷£ºÒ»¹²ÓÐ5ÖÖ£¬ÉÏͼµÄÀý×Ó³oÏÖÁËÁ½ÖÖ¡£
. £º´u±iÕýÈ*
F £º´u±i¶ÏÑÔ´iÎo
E £º´u±iPHP³ÌÐo´iÎo»oÊÇÒi³£
I £º ´u±iûÓÐʵÏֵĽ¨
S : ´u±iÊÇÌø¹ýµÄ½¨
Éu²uµÄ¸²¸ÇÎļþ˵Ã÷£º
Classes: Ö»ÓÐÒ»¸oÀaÖеÄËuÓн¨¶¼±»¸²¸ÇµÄʱºo£¬Õa¸oÀa²ÅËaÊDZ»²aÊÔÍeµÄ
Functions/Methods £ºÖ»ÓÐÒ»¸o½¨»oÊǺ¯ÊýµÄËuÓÐÓÐЧµÄÓi¾a´uÂe¶¼±»Ö´Ðе½Á˲ÅËaÕa¸o½¨»oÊǺ¯ÊýÊDZ»²aÊÔÍeµÄ
Lines: ×ÜÐÐÊý½«»a²»±¥ÐÐ×¢ÊÍ£¬¿ÕÐУ¬<?php ?> ±eÇ(C)£¬ ¼°Àa¼°½¨µÄÉuÃ÷¡£
ʹÓÃphpunit ¨Ccoverage-clover D:\PHPAPP\XDebug\first.xml YouTest
Éu²uµÄ½«»aÊÇÒ»¸oxml¸ñʽµÄÎļþ£¬Õa¸o¸ñʽµÄÎļþЧ¹u²»Ã÷ÏÔ£¬Ã»ÓÐhtml¸ñʽµÄºÃ£¬Õa±ßµÄЧ¹u±»ÎÒɾµoÁËËuÒÔôÓÐЧ¹uͼ¿É¿´£¬µÚÈý¸o¸²¸ÇÎļþµÄ²ÎÊýÎÒû²aÊÔ¹ý£¬´o¼ÒÓÐÐËȤ¿ÉÒÔÊÔÊÔ¡£
**Èý¡¢****³ÌÐoÖ´ÐÐÐÔÄÜ*ÖÎo******XDebug³ýÁËÓÐЧµÄ°iÖuÖÎoµ¥Ôª²aÊÔ¸²¸ÇÂÊÖ®Ía£¬»¹¿ÉÒÔ°i×eÖÎo³ÌÐoÖ´ÐеÄÆ¿¾±ËuÔÚ£¬¿ªÆo*ÖÎoµÄ¹¦ÄÜ£º
xdebug.profiler_enable = on
xdebug.profiler_output_dir=D:\PHPAPP\XDebug
ÉeÖÃÉÏÃaeÁ½Ïi£¬È»ºoÖ´ÐÐÄaÒªÖÎoµÄ³ÌÐo£¬¾Í»aÔÚÉÏÃaeµÄĿ¼Ï¿´µ½cachegrind.out.XXXµÄÎļþ£¬Õa¸oÎļþÖ±½Ó´o¿ª¾ÍÊÇÒ»Ð(C)¼Ç¼£¬ÐeÒª½eÖuµÚÈý½µÄcachegrind²e¿´¹¤¾ß²ÅÐУ¬Ò»¸oºÃÓõŤ¾ßÊÇwinCacheGrind£¬²e¿´ÆðÀ´ºÜ*½±a¡£
¿ÉÒÔ¿´µ½Ö´ÐеÄ×Üʱ¼a£¬¼°Ã¿¸oº¯ÊýÖ´ÐеÄʱ¼a¡£
ÒoΪÕa¸o¹¤¾ßÔÚ´o¿ªÎļþµÄʱºo£¬Ö»ÄÜ´o¿ªcachegrind.out.µÄÎļþ£¬ËuÒÔ´ýÖÎoµÄÎļþ±ØÐeÊÇÕa¸oÃu×ֵģ¬ËuÒÔΪÁËÊ¡È¥ÖØÃuÃu£¬ÕaÒ²¾ÍÊÇΪɶÎÒ˵²»½¨ÒeÐÞ¸Äxdebug.profiler_output_nameÕa¸oÑ¡ÏiµÄÔÒo¡£
**ËÄ¡¢****XDebug****¿aº¯Êý******XDebug³ýÁËÉÏÊo½Ê½Ía£¬»¹ÓÐ×Ô¼ºµÄÒ»Ð(C)º¯Êý¿aÌa¹(C)£¬¿ÉÒÔÔÚÄa³ÌÐoµÄ´uÂe¶ÎÈκεؽִÐУ¬¾ßÌaµÄÇe¿´http://xdebug.org/docs/all_functions
XDebugµÄ¹¦ÄÜ£¬»¹²»Ö¹ÕaÐ(C)£¬ÒoΪËuµÄÑ¡Ïi¡¤ºÃ´oµÄÒ»Ò³£¬ËuÒÔ»¹ÊÇÈ¥http://xdebug.org/docs/ÕaÀi¿´¿´¹Ù*½µÄ˵Ã÷¡£¿¿Æ×£¡