pear upgrade pear
查看升級(jí)后的版本
pear –V
PEAR Version: 1.9.4
PHP Version: 5.3.5
Zend Engine Version: 2.3.0
Running on: Windows NT ARTHUR-PC 6.1 build 7600 (Unknow Windows version
Ultimate Edition) i586
升級(jí)PHPUnit的版本到3.6,pear自帶的版本太低了。
pear upgrade pear/PHPUnit
出現(xiàn)更新失敗的信息
pear/PHPUnit is already installed and is the same as the released version 1.3.2
upgrade failed
先卸載當(dāng)前的PHPUnit版本
pear uninstall pear/PHPUnit
注意設(shè)置自動(dòng)添加頻道
pear config-set auto_discover 1
添加PHPUnit的必要頻道
pear channel-discover components.ez.no
pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
安裝PHPUnit
pear install --alldeps phpunit/PHPUnit
查看PHPUnit的版本
phpunit –V
PHPUnit 3.6.3 by Sebastian Bergmann.
添加pear的路徑到你的環(huán)境變量,例如D:xamppphp。這樣能直接打pear命令了。
編寫你的第一個(gè)測(cè)試
cd /d D:xampphtdocsdev142 ests
新建index.php文件
<?php//This is my first testclassMyFirstTestextendsPHPUnit_Framework_TestCase{publicfunctiontestFirst(){$stack=array();$this->assertEquals(0,count($stack));}}?>
測(cè)試你編寫的代碼
phpunit index.php
PHPUnit 3.6.3 by Sebastian Bergmann.
.
Time: 0 seconds, Memory: 3.50Mb
OK (1 test, 1 assertion)