Code completion for PHPUnit and Selenium in NetBeans

后端 未结 2 884
广开言路
广开言路 2021-02-01 08:50

How can I get NetBeans to provide code-completion for PHPUnit classes and methods?

I have already tried downloading from the PHPUnit GitHub project, but I didn\'t unders

2条回答
  •  孤独总比滥情好
    2021-02-01 09:51

    Moving away from PEAR...(I'd even uninstall the PEAR version to avoid conflicts first).

    1. Download PHPUnit with sources https://github.com/sebastianbergmann/phpunit and extract somewhere semi-permanent /your-install-path
    2. Add /your-install-path/phpunit to your PATHs
    3. In Netbeans options (Tools > Options on Windows, Netbeans > Preferences on OS X), go to PHP tab..

      a. Under the General tab, Add Folder... and select the /your-install-path/src/ folder - this will make the auto complete work

      b. Go to Frameworks & Tools tab, PHPUnit, select the /your-install-path/phpunit and /your-install-path/phpunit-skelgen respectively - this will make PHPUnit tool work within Netbeans

    4. In your project settings, right click project name > Settings, Testing category, enable PHPUnit. Optionally go to the Testing > PHPUnit settings panel and make adjustments for your project.

    Edit:
    When I followed the instructions above, the output window told me I needed to install dependencies using "composer install." These additional steps were needed on my machine (running Netbeans 8.2 on Windows 7).

    1. Download Composer and install: https://getcomposer.org/doc/00-intro.md

    2. Modify your-install-path/composer.json by adding the version number between the "description" and "type" keywords like so:

      "description": "The PHP Unit Testing framework.",
      "version": "5.7.8",
      "type": "library",
      
    3. Using the command line, type the following (this is a windows machine, for mac or lunix, it should be a little different):

      cd your-install-path
      composer install
      

提交回复
热议问题