Installation 試試這個網站,他在每一個步驟如何安裝你需要的一切解釋了一切。
我就複製粘貼在這裏:
現金去史蒂芬喬治!
安裝PEAR
注意:你不能有任何空格路徑,以PHP和梨。因此,請確保PHP不安裝在「程序文件」目錄中,否則將永遠不會從命令行獲得PEAR。
Download PEAR
Extract the archive using WinRAR
Create a 「PEAR」 directory in C:\PHP
Copy the contents of the PEAR-x.x.x directory to the PEAR directory you just created
Download Console Getopt, Archive Tar, and Structures Graph
Create the directory c:\PHP\PEAR\Console. Unzip and copy 「Getopt.php」 from the Console Getopt zip file into it.
Create the directory c:\PHP\PEAR\Archive. Unzip and copy 「Tar.php」 from the ArchiveTar zip file into it.
Create the directory c:\PHP\PEAR\Structures. Unzip and copy 「Graph.php」 and the contents of the 「Graph」 directory from the Structures Graph zip file into it.
Edit your php.ini and add your php PEAR directory to your include_path
Edit your system environment variables as follows:
PHP_PEAR_BIN_DIR = C:\PHP\PEAR\scripts\
PHP_PEAR_INSTALL_DIR = C:\PHP\PEAR\
PHP_PEAR_PHP_BIN = C:\PHP\php.exe
Add C:\PHP\PEAR\scripts to your 「Path」 environment variable
Run a command prompt as Administrator
cd to C:\PHP\PEAR\scripts
Create a pear.ini file in c:\Windows. Alter the permissions so that any user can write to and modify it.
Run the following commands:
pear config-set auto_discover 1
pear config-set bin_dir c:\PHP\PEAR\scripts
啓用捲曲
Copy php_curl.dll from the php 「ext」 directory to the Windows System32 directory
Edit php.ini and uncomment the line that references the cURL extension.
安裝PHPUnit的
You need to install specific versions of PHPUnit components if you are running Zend Framework 1.x (see: http://dustyreagan.com/downgrade-phpunit-3-6-to-3-5-15/). From the administrative command prompt you opened earlier, run the commands:
pear channel-discover pear.phpunit.de
pear install --alldeps --force phpunit/PHPUnit
pear install phpunit/DbUnit
pear install phpunit/PHPUnit_Selenium
pear install phpunit/PHPUnit_Story
安裝Java JRE
Download JRE
Install it as normal
安裝硒
Download Selenium Server
Create a directory called 「Selenium」 in C:\Program Files\Java\jre7\bin
Copy the file you downloaded in step 1 into this directory. It should be called 「selenium-server-standalone-x.xx.x.jar」
Create a new MS batch file called Selenium.bat on your desktop. Inside, type the command
java -jar "c:\Program Files\Java\jre7\bin\Selenium\selenium-server-standalone-2.25.0.jar」 (note: Include the quotation marks and substitute the version number for the version you downloaded)
下載一個PHP的webdriver庫
I like the Facebook one: https://github.com/facebook/php-webdriver
運行硒
Execute the bat file you created for Selenium above. This will lauch the selenium service that will listen for incoming commands from your test scripts.
您現在就可以編寫使用PHP庫的webdriver PHPUnit測試。該庫將通過運行批處理文件時打開的端口(4444)與Selenium通信。