尊龙凯时人生就是搏

ÔõÑù¾ÙÐÐThinkPHP6µÄµ¥Î»²âÊÔ £¿

Ëæ×Å»¥ÁªÍøµÄÉú³¤£¬ÏÖÔÚµÄÈí¼þ¿ª·¢±äµÃÔ½À´Ô½ÖØ´ó£¬ÔÚ´úÂëµÄÖÊÁ¿ºÍÎȹÌÐÔÉ϶¼ÓÐ×ÅÔ½À´Ô½¸ßµÄÒªÇó¡£µ¥Î»²âÊÔ£¨unit testing£©ÊÇ°ü¹ÜÈí¼þÖÊÁ¿ºÍÎȹÌÐÔµÄÒ»ÖÖÓÐÓÃÊֶΡ£ÔÚphp¿ª·¢ÖУ¬thinkphpÊÇÒ»ÖÖ¼«Îª³£ÓõÄmvc¿ò¼Ü¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚthinkphp6ÖоÙÐе¥Î»²âÊÔ¡£

Ò»¡¢Ê²Ã´Êǵ¥Î»²âÊÔ

µ¥Î»²âÊÔµÄÄ¿µÄÊǶԳÌÐòÄ £¿é¾ÙÐÐ׼ȷÐÔÄ¥Á·¡£µ¥Î»²âÊÔÊÇÈí¼þ¿ª·¢ÖеÄÒ»ÖÖ²âÊÔÒªÁ죬רÃÅÕë¶Ô³ÌÐòÄ £¿é£¨Unit£©¾ÙÐÐÉè¼ÆºÍÖ´ÐеIJâÊÔ¡£µ¥Î»²âÊÔÐèÒª³ÌÐòÔ±±àдµ¥Î»²âÊÔÓÃÀý£¬È»ºóʹÓÃÌض¨µ¥Î»²âÊÔ¹¤¾ßÖ´ÐÐÕâЩÓÃÀý£¬ÑéÖ¤³ÌÐòÄ £¿éµÄ׼ȷÐÔ¡£

ÔÚ¾ÙÐе¥Î»²âÊÔµÄÀú³ÌÖУ¬ÎÒÃÇ¿ÉÒÔ·¢Ã÷Ä £¿é¼äµÄñîºÏ¹ý¸ß£¬»òÕßijЩÇéÐÎÏÂÎÞ·¨Õý³£ÔËÐУ¬´Ó¶øʵʱ·¢Ã÷²¢½â¾öÎÊÌ⡣ͬʱ£¬µ¥Î»²âÊÔÒ²ÓÐÖúÓÚÌá¸ß´úÂëÖÊÁ¿ºÍ¿Éά»¤ÐÔ£¬Ìá¸ß¿ª·¢Ð§ÂÊ£¬Ëõ¶Ì¿ª·¢ÖÜÆÚ¡£

¶þ¡¢ThinkPHP6µÄµ¥Î»²âÊÔ

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

ThinkPHP6µÄµ¥Î»²âÊÔ½ÓÄÉÁËPHPUnit¿â£¬ÊÇÏÖÔÚPHPÁìÓòÖÐ×îÊ¢ÐС¢×î³ÉÊìµÄ²âÊÔ¿ò¼ÜÖ®Ò»¡£PHPUnit¾ßÓи»ºñ¶øÍêÉƵĹ¦Ð§£¬Ö§³ÖÖÖÖÖÀàÐ͵ĶÏÑÔ£¬Äܹ»¾ÙÐÐÁýÕÖÂÊÆÊÎö£¬»¹Ö§³Ö²âÊÔЧ¹ûÊä³öºÍ²âÊÔ±¨¸æÌìÉúµÈ¹¦Ð§¡£

ÔÚThinkPHP6ÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ý½¨Éè²âÊÔÀàÀ´¾ÙÐе¥Î»²âÊÔ¡£ÀýÈçÎÒÃǽ¨ÉèÒ»¸ö²âÊÔÀàtestsunitDemoTest.phpÀ´²âÊÔÎÒÃǵijÌÐò£º

<?php
namespace testsunit;

use PHPUnitFrameworkTestCase;

class DemoTest extends TestCase
{
    public function testAdd()
    {
        $this->assertEquals(2+2, 4);
    }
}

µÇ¼ºó¸´ÖÆ

ÉÏÃæÕâ¸öʾÀý²âÊÔÁËÒ»¸ö±»²âÒªÁì testAdd()£¬Í¨¹ý $this->assertEquals() ÒªÁì¾ÙÐжÏÑÔ£¬ÅÐ¶Ï 2+2 ÊÇ·ñ¼´ÊÇ 4¡£ÕâÊÇÒ»¸ö¼«Îª¼òÆӵIJâÊÔÓÃÀý£¬Ö¼ÔÚ˵Ã÷ÔõÑù¾ÙÐвâÊÔ¡£ÏÖÕæÏàÐÎÖÐÎÒÃǽ«²âÊÔ¸üÖØ´óµÄ¹¦Ð§Ä £¿é¡£

½ÓÏÂÀ´£¬ÔÚÏÂÁîÐÐÖÐÖ´ÐÐÒÔÏÂÏÂÁ¾Í¿É¾ÙÐвâÊÔÁË£º

./vendor/bin/phpunit tests/unit/DemoTest.php

µÇ¼ºó¸´ÖÆ

ÔËÐвâÊÔºó£¬PHPUnit½«Êä³ö²âÊÔЧ¹ûºÍÁýÕÖÂʱ¨¸æµÈÐÅÏ¢¡£

Èý¡¢µ¥Î»²âÊԵļ¼ÇÉ

Êý¾Ý¸ôÀë

µ¥Î»²âÊԵIJâÊÔÇéÐÎÓ¦¸Ã¸ôÀëÆäËûÇéÐΣ¬²»Ó¦¸ÃÓëÆäËû²âÊÔÓÃÀý¹²ÏíÊý¾Ý¿â»òÎļþ×ÊÔ´µÈ¡£Õâ¿ÉÒÔ×èÖ¹²âÊÔÓÃÀýÖ®¼äÏ໥ӰÏ죬ͬʱʹµÃ²âÊÔЧ¹ûÔ½·¢×¼È·¡£

²âÊÔÁýÕÖÂÊ

²âÊÔÁýÕÖÂÊÊÇÖ¸²âÊÔÓÃÀýÄܹ»ÁýÕÖµ½³ÌÐòÖеÄÄÄЩ´úÂ벿·Ö¡£²âÊÔÁýÕÖÂÊÔ½¸ß£¬Òâζ×ÅÎÒÃDzâÊԵĴúÂë¶ÎÔ½¶à£¬´úÂëµÄÖÊÁ¿Ò²Ô½ÈÝÒ×»ñµÃ°ü¹Ü¡£ÔÚPHPUnitÖУ¬ÎÒÃÇ¿ÉÒÔʹÓà –coverage-html ²ÎÊýÌìÉú²âÊÔÁýÕÖÂʱ¨¸æ£º

./vendor/bin/phpunit tests/unit/DemoTest.php --coverage-html coverage/

µÇ¼ºó¸´ÖÆ

ÌìÉúµÄÁýÕÖÂʱ¨¸æ½«ÉúÑÄÔÚ coverage Ŀ¼Ï£¬ÎÒÃÇ¿ÉÒÔÔÚä¯ÀÀÆ÷ÖÐÉó²é¡£

²âÊÔʧ°Ü´¦Àí

µ±²âÊÔÓÃÀýÖ´ÐÐʧ°Üʱ£¬ÎÒÃÇÐèҪʵʱ¶¨Î»Ï¢Õù¾öÎÊÌ⣬²»È»²âÊÔʧ°ÜµÄ±¨¸æ½«ËÁÎ޼ɵ¬µØÊä³ö¡£ÔÚPHPUnitÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ý –stop-on-failure ²ÎÊýÔÚ²âÊÔʧ°Üʱ×èÖ¹²âÊÔ£¬Ò²¿ÉÒÔʹÓà –debug ²ÎÊýÔÚ²âÊÔʧ°ÜʱÆôÓõ÷ÊÔģʽ¡£

ËÄ¡¢×ܽá

ͨ¹ýµ¥Î»²âÊÔ£¬ÎÒÃÇ¿ÉÒÔ·¢Ã÷³ÌÐòÖÐÒþ²ØµÄ¹ýʧ»òÎÊÌ⣬²¢ÊµÊ±´¦Àí£¬Ìá¸ß´úÂëÖÊÁ¿ºÍ³ÌÐòÎȹÌÐÔ¡£ÔÚThinkPHP6ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃPHPUnit¿â¾ÙÐе¥Î»²âÊÔ£¬ÕâÊÇ°ü¹Ü³ÌÐòÖÊÁ¿ºÍÎȹÌÐÔµÄÓÐÓÃÊֶΡ£Í¬Ê±£¬ÎÒÃÇ»¹ÐèҪעÖØһЩ¼¼ÇÉ£¬ÈçÊý¾Ý¸ôÀë¡¢²âÊÔÁýÕÖÂÊ¡¢²âÊÔʧ°Ü´¦ÀíµÈ¡£

ÒÔÉϾÍÊÇÔõÑù¾ÙÐÐThinkPHP6µÄµ¥Î»²âÊÔ £¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ