×ðÁú¿­Ê±¹ÙÍøµÇ¼

Laravel¿ª·¢£ºÔõÑùʹÓÃLaravel Dusk¾ÙÐÐä¯ÀÀÆ÷¶Ëµ½¶Ë²âÊÔ£¿

laravelÊÇÒ»¸öÊ¢ÐеÄphp¿ª·¢¿ò¼Ü£¬ËüÌṩÁ˸»ºñµÄÌØÕ÷ºÍ¹¤¾ßÀ´¼ò»¯webÓ¦ÓóÌÐòµÄ¿ª·¢¡£ÆäÖÐÒ»¸öÌØÕ÷ÊÇlaravel dusk¡£laravel duskʹµÃ¿ª·¢Õß¿ÉÒÔ±àдä¯ÀÀÆ÷¶Ëµ½¶Ë²âÊÔ£¬´Ó¶øÈ·±£Ó¦ÓóÌÐòµÄÎȹÌÐԺͿɿ¿ÐÔ¡£ÔÚÕâƪÎÄÕÂÖУ¬ÎÒÃǽ«ÉîÈë̽ÌÖÔõÑùʹÓÃlaravel dusk¾ÙÐÐä¯ÀÀÆ÷¶Ëµ½¶Ë²âÊÔ¡£

Ò»¡¢×°ÖÃLaravel Dusk

ÔÚʹÓÃLaravel Dusk֮ǰ£¬ÐèҪȷ±£Ó¦ÓóÌÐòÒÑ×°ÖúÃLaravel 5.4¼°ÒÔÉÏ°æ±¾¡£Æä´Î£¬Ê¹ÓÃComposer×°ÖÃLaravel Dusk¡£

Ê×ÏÈ£¬·­¿ªÖն˲¢Òƶ¯µ½Ó¦ÓóÌÐòµÄ¸ùĿ¼¡£È»ºóÔËÐÐÒÔÏÂÏÂÁ

composer require --dev laravel/dusk
php artisan dusk:install

µÇ¼ºó¸´ÖÆ

ÉÏÊöÏÂÁÏÂÔز¢×°ÖÃLaravel Dusk£¬È»ºóÌìÉúÒ»¸öʾÀý²âÊÔÎļþ¡£

¶þ¡¢±àд²âÊÔ

ÌìÉúµÄʾÀý²âÊÔÎļþÔÚtests/Browser/ExampleTest.php·¾¶Ï¡£¸ÃÎļþ°üÀ¨ÁËÒ»¸öÓÃÓÚ²âÊÔÓ¦ÓóÌÐòµÄÒ³Ãæ¡£·­¿ªÕâ¸öÎļþÎÒÃÇ¿ÉÒÔ¿´µ½Ò»Ð©»ù±¾µÄ²âÊÔÓÃÀý¡£

ÔÚÕâ¸öÎļþÖУ¬ÎÒÃÇ¿ÉÒÔ½ç˵ÔÚä¯ÀÀÆ÷ÖÐÔËÐеIJâÊÔ£¬ÕâЩ²âÊÔº¯ÊýÒÔtest¿ªÍ·¡£ÀýÈ磬ÔÚÏÂÃæµÄʾÀýÖУ¬ÎÒÃÇΪµÇ¼ҳÃæ±àдÁËÒ»¸ö»ù±¾µÄ²âÊÔÓÃÀý£º

public function testLogin()
{
    $this->browse(function (Browser $browser) {
        $browser->visit('/login')
            ->type('email', 'email@example.com')
            ->type('password', 'password')
            ->press('Log in')
            ->assertPathIs('/')
            ->assertAuthenticated();
    });
}

µÇ¼ºó¸´ÖÆ

¸Ã²âÊÔÓÃÀý»á¼ûµÇ¼ҳÃ棬ÊäÈëµç×ÓÓʼþºÍÃÜÂ룬Ȼºóµã»÷¡°µÇ¼¡±°´Å¥¡£×îºó£¬Ëü¶ÏÑÔÓû§Ä¿½ñµÇ¼£¬²¢ÑéÖ¤Ó¦ÓóÌÐòÊÇ·ñ׼ȷµØÖض¨Ïòµ½ÁËÖ÷Ò³ÉÏ¡£

Èý¡¢ÔËÐвâÊÔ

ÓëÆäËûLaravel²âÊÔÒ»Ñù£¬¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÔËÐÐLaravel Dusk²âÊÔ£º

php artisan dusk

µÇ¼ºó¸´ÖÆ

Õ⽫Æô¶¯Ò»¸öChromiumä¯ÀÀÆ÷£¬²¢ÔÚÆäÖÐÔËÐвâÊÔ¡£²âÊÔЧ¹û½«ÔÚÖÕ¶ËÖÐչʾ¡£

ËÄ¡¢¸ß¼¶ÌØÕ÷

ÔÚ±àд²âÊÔÓÃÀýʱ£¬Laravel DuskÌṩÁËÐí¶à¸ß¼¶¹¦Ð§£¬ÒÔÈ·±£²âÊÔµÄ׼ȷÐԺͿɿ¿ÐÔ¡£ÀýÈ磺

Ä£ÄâÓû§½»»¥£ºLaravel DuskÌṩÁËÒ»×éÓÃÓÚÄ£ÄâÓû§½»»¥µÄÒªÁ죬ÀýÈçclick£¬type£¬scrollµÈ¡£ÕâÑù£¬²âÊÔÖ°Ô±¿ÉÒÔÄ£ÄâÓû§ÔÚÓ¦ÓóÌÐòÖеÄËùÓн»»¥£¬ÒÔÈ·±£ÏµÍ³µÄÍêÕûÐÔºÍ׼ȷÐÔ¡£

²Ù×÷ä¯ÀÀÆ÷£ºLaravel Dusk»¹ÌṩÁËһЩ²Ù×÷ä¯ÀÀÆ÷´°¿ÚµÄ¹¦Ð§£¬ÀýÈ罫´°¿Ú×î´ó»¯»ò×îС»¯£¬ÉèÖô°¿Ú¾Þϸ»òλÖõÈ¡£

¶ÏÑÔ£º³ýÁËÉÏÃæʾÀýÖÐÏÈÈݵĶÏÑÔÖ®Í⣬Laravel Dusk»¹ÌṩÁËÐí¶àÆäËû¶ÏÑÔÒªÁ죬ÒÔÑéÖ¤Ó¦ÓóÌÐòÊÇ·ñÇкÏÔ¤ÆÚЧ¹û¡£

²¢ÐвâÊÔ£ºLaravel Dusk¿ÉÒÔÔÚ¶à¸öä¯ÀÀÆ÷ʵÀýÖв¢ÐÐÔËÐвâÊÔ£¬´Ó¶øÌá¸ß²âÊÔËÙÂÊ¡£ÕâÔÚ¶Ô´óÐÍÓ¦ÓóÌÐò¾ÙÐвâÊÔʱÌØÊâÓÐÓá£

×ܽá

Laravel DuskÊÇÒ»¸öÇ¿Ê¢µÄ¹¤¾ß£¬ÓÃÓÚÈ·±£Ó¦ÓóÌÐòÔÚä¯ÀÀÆ÷¶ËµÄ¿ÉÓÃÐÔºÍ׼ȷÐÔ¡£Í¨¹ýÔËÐÐä¯ÀÀÆ÷¶Ëµ½¶Ë²âÊÔ£¬¿ÉÒÔ·¢Ã÷²¢½â¾öDZÔڵĹýʧºÍÎó²î£¬Ìá¸ßÓ¦ÓóÌÐòµÄÎȹÌÐԺͿɿ¿ÐÔ¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃÇÑо¿ÁËÔõÑù×°ÖúÍʹÓÃLaravel Dusk£¬ÒÔ¼°ÔõÑùʹÓÃÆäÇ¿Ê¢µÄ¹¦Ð§À´±àдÍêÕûµÄä¯ÀÀÆ÷×Ô¶¯»¯²âÊÔ¡£

ÒÔÉϾÍÊÇLaravel¿ª·¢£ºÔõÑùʹÓÃLaravel Dusk¾ÙÐÐä¯ÀÀÆ÷¶Ëµ½¶Ë²âÊÔ£¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

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

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

QR code
ÍøÕ¾µØͼ