Eclipse PDT & PHPUnit?

后端 未结 13 1266
野的像风
野的像风 2021-01-30 17:35

Is there any integration of PHPUnit with Eclipse PDT?

If not, are there any plans to do so?

13条回答
  •  -上瘾入骨i
    2021-01-30 18:02

    There is defnitely integration for Eclipse PDT and PHPUnit. both PHPSRC and MakeGood work well though I am a fan of MakeGood for phpunit phpsrc comes with other goodies like CodeSniffer. I have branched a PHPUnit CodeSniffer Standard on github that validates the quality of phpunit tests which I can run with the Eclipse PHP Tools CodeSniffer plugin. This has updates for new phpunit package like setUp and tearDown.

    makes sure there is assertions in tests. Something devs like to leave out when trying to meet code coverage metrics no assertions in test

    Makes sure there is no more than 1 assertion per test. A best practice too many tests

    Setting up PDT in Eclipse is not straightforward.

    There's a lot of tiny details involved Here's the high level steps.

    • 1 Windows update

      2 Install JRE a. http://www.java.com/en/download/index.jsp

      3 Create a folder C:\eclipse\workspace

      4 Install eclipse pdt
      a. http://www.zend.com/en/downloads/thankyou?package=573

      5 Install xampp –win32-1.81-vc9
      a. http://sourceforge.net/projects/xampp/files/XAMPP%20Windows/1.8.1/xampp-win32-1.8.1-VC9-installer.exe/download

      6 Install pear phpunit

    pear clear-cache
    pear upgrade pear
    pear update-channels
    pear upgrade --alldeps -f 
    pear channel-discover pear.phpunit.de
    pear channel-discover pear.symfony-project.com
    pear channel-discover components.ez.no
    pear install --alldeps phpunit/PHPUnit
    
    • 7 Install Xdebug plugin

      a. http://xdebug.org/files/php_xdebug-2.2.1-5.4-vc9.dll

      b. Phpinfo settings for xdebug

    [xdebug]

    zend_extension = "C:\xampp\php\ext\php_xdebug-2.2.1-5.4-vc9.dll"
    xdebug.remote_enable=1
    xdebug.remote_handler="dbgp"
    xdebug.remote_mode="req"
    xdebug.remote_port=9000    
    xdebug.remote_host = "127.0.0.1"
    xdebug.remote_log="C:\xampp\php\logs"
    
    • 8 Install MakeGood a. http://eclipse.piece-framework.com/

    It took me nearly 3 days to finally get everything right so I put together a video tutorial

    Good luck!

提交回复
热议问题