linux下安裝phpunit

安裝pear 的命令以下:
$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar
若是報出PHP Warning:  file_exists(): open_basedir restriction in effect. 
問題是出如今了PHP.INI上面了 
 緣由是php.ini裏設置了   
  open_basedir = .:/tmp/
註釋了就能夠了
pear 安裝成功!

若是要全局安裝 PHAR:php

$ wget https://phar.phpunit.de/phpunit.phar
$ chmod +x phpunit.phar
$ sudo mv phpunit.phar /usr/local/bin/phpunit
$ phpunit --version

測試結果說明:一共有5種,上圖的例子出現了兩種。bootstrap

   .   :表明正確函數

   F    :表明斷言錯誤測試

   E   :表明PHP程序錯誤或是異常spa

   I    : 表明沒有實現的方法.net

   S   :  表明是跳過的方法rest

生產的覆蓋文件說明:get

Classes: 只有一個類中的全部方法都被覆蓋的時候,這個類纔算是被測試完的it

Functions/Methods :只有一個方法或是函數的全部有效的語句代碼都被執行到了纔算這個方法或是函數是被測試完的io

Lines:   總行數將會不飽行註釋,空行,<?php ?> 標籤, 及類及方法的聲明。

安裝自動生成PHPUnit測試骨架腳本phpunit-skelgen

 

wget https://phar.phpunit.de/phpunit-skelgen.phar
chmod +x phpunit-skelgen.phar
mv phpunit-skelgen.phar /usr/local/bin/phpunit-skelgen
用法:
phpunit-skelgen generate-test [--bootstrap="..."] class [class-source] [test-class] [test-source]
相關文章
相關標籤/搜索