[Solved] PHP Auto Testing – NeatBeans+PHPUnit+Selenium

Please read this article carefully, because it can save you much time for building php auto-testing env.
Please do NOT try to fix one-by-one errors, except that you can get some fun as you need (Sometime some coders like to do it).

System configuration (even though it is not same as yours, please go ahead and I am sure it can help)
1. Windows
2. Xampp 1.8.2 (MYSQL 5.6, PHP 5.3)
3. Netbeans 7.4

There are some steps,
1. install phpunit with composer and Git
2. install Selenium
3. configure netbeans IDE

1. install phpunit with composer and Git

Note: Please do NOT waste time to use pear to install phpunit, because the phpunit offical has shut down the pear service from 12/31/2014

a) download Git from http://git-scm.com/download/win and install it, because composer needs

b) download composer from https://getcomposer.org/Composer-Setup.exe and install it

d)create file C:\Users\{windowusernamehere}\AppData\Roaming\Composer\composer.json with content

{
    "repositories": [
        {
            "type": "composer",
            "url": "http://packages.phundament.com"
        },
        {
            "type": "package",
            "package": {
                "name": "phpunit/php-invoker",
                "version": "1.1.3",
                "source": {
                    "type": "git",
                    "url": "http://github.com/sebastianbergmann/php-invoker",
                    "reference": "master"
                },
                "autoload": {
                    "classmap": [
                        "PHP/"
                    ]
                }
            }
        }
    ],
    "require": {
        "phpunit/phpunit": "4.1.*",
        "phpunit/phpunit-selenium": "*",
        "phpunit/phpunit-skeleton-generator": "*",
        "phpunit/dbunit": "*",
        "phpunit/phpunit-story": "*",
        "phpunit/php-invoker": "*",
        "phpunit/phpunit-mock-objects": "*"
    }
}

e) exceute command: composer global require “phpunit/phpunit=4.1.*” and then phpunit/phpunit-selenium/phpunit-skeleton-genertor/dbunit/phpunit-story/php-invoker/phpunit-mock-objects will be installed.

f) check batch files(phpunit.bat and phpunit-skelgen.bat) in C:\Users\{windowusernamehere}\AppData\Roaming\Composer\vendor\bin for netbeans configuration.

2. install Selenium

a) download selenium server from  http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar

b) you can use the command to startup:  java -jar selenium-server-standalone-2.42.2.jar

The above two steps are from http://polyetilen.lt/en/installing-phpunit-with-composer-on-windows, so many thanks.

3. configure netbeans IDE

Please see to https://netbeans.org/kb/docs/php/phpunit.html

a) for installing netbeans selenium module for php, you can download from http://plugins.netbeans.org/plugin/37753/selenium-module-for-php

4. fix netbean bug for phpunit-skeleton-generator

You can fix the bug as https://netbeans.org/bugzilla/show_bug.cgi?id=245179

or use Netbeans 8.0 instead of Netbeans 7.4

follow the netbean instruction (https://netbeans.org/kb/docs/php/phpunit.html) to use it

Have fun!

Secondary installation

When I follow the above step to install for my new environment, I encounter a error like

“vendor/phpunit/php-invoker/PHP/ which does not appear to be a file nor a folder”

I do try to fix it and copy the vendor folder to new one. attached here

please extract to C:\Users\{windowusernamehere}\AppData\Roaming\Composer\