XamPP 安装/升级PHPUnit
2015-03-17 PHP 860
PHPUnit是一个轻量级的 PHP测试框架。它是在PHP5下面对JUnit3系列版本的完整移植,是xUnit测试框架家族的一员(它们都基于模式先锋Kent Beck的设计)。
安装XAMPP,自动会安装pear和PHPUnit 但是,版本会很低,需要进
PHPUnit是一个轻量级的 PHP测试框架。它是在PHP5下面对JUnit3系列版本的完整移植,是xUnit测试框架家族的一员(它们都基于模式先锋Kent Beck的设计)。
安装XAMPP,自动会安装pear和PHPUnit 但是,版本会很低,需要进行升级,我写一下我的升级步骤。
假设我的XAMPP 安装在G盘
1.进入DOS ,进入 G/XAMPP/PHP目录(如果把 G/xampp/php添加到环境变量就不用进入指定文件夹了)。
2.升级pear
pear upgrade pear
XamPP <wbr>安装/升级PHPUnit
G:\xampp\php>pear upgrade pear
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
pear/Console_Getopt requires PEAR Installer (version >= 1.8.0), installed versio
n is 1.7.2
downloading PEAR-1.9.4.tgz ...
Starting to download PEAR-1.9.4.tgz (296,332 bytes)
..............................done: 296,332 bytes
downloading Archive_Tar-1.3.8.tgz ...
Starting to download Archive_Tar-1.3.8.tgz (17,995 bytes)
...done: 17,995 bytes
downloading Structures_Graph-1.0.4.tgz ...
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)
...done: 30,318 bytes
upgrade ok: channel://pear.php.net/Archive_Tar-1.3.8
ERROR: unable to unpack C:\Users\lmm\AppData\Local\Temp\pear\download\Structures
_Graph-1.0.4.tgz
upgrade ok: channel://pear.php.net/PEAR-1.9.4
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
3.查看pear版本
pear -V
G:\xampp\php>pear -V
PEAR Version: 1.9.4
PHP Version: 5.3.5
Zend Engine Version: 2.3.0
Running on: Windows NT LMM-PC 6.1 build 7601 (Unknow Windows version Home Basic
Edition Service Pack 1) i586
4.升级phpUnit发现失败。
pear upgrade pear/phpUnit
G:\xampp\php>pear upgrade pear/phpUnit
pear/phpUnit is already installed and is the same as the released version 1.3.2
upgrade failed
5.需要卸载原来的版本
pear uninstall pear/phpUnit
G:\xampp\php>pear uninstall pear/phpUnit
uninstall ok: channel://pear.php.net/PHPUnit-1.3.2
6.设置频道
pear config-set auto_discover 1
pear channel-discover components.ez.no
pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
G:\xampp\php>pear config-set auto_discover 1
config-set succeeded
G:\xampp\php>pear channel-discover components.ez.no
Adding Channel "components.ez.no" succeeded
Discovery of channel "components.ez.no" succeeded
G:\xampp\php>pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded
G:\xampp\php>pear channel-discover pear.symfony-project.com
Adding Channel "pear.symfony-project.com" succeeded
Discovery of channel "pear.symfony-project.com" succeeded
7.安装phpunit
pear install --alldeps phpunit/PHPUnit
G:\xampp\php>pear install --alldeps phpunit/PHPUnit
phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2
.0.5)
phpunit/PHP_Invoker requires PHP extension "pcntl"
downloading PHPUnit-3.6.10.tgz ...
Starting to download PHPUnit-3.6.10.tgz (118,595 bytes)
..........................done: 118,595 bytes
downloading File_Iterator-1.3.1.tgz ...
Starting to download File_Iterator-1.3.1.tgz (5,157 bytes)
...done: 5,157 bytes
downloading Text_Template-1.1.1.tgz ...
Starting to download Text_Template-1.1.1.tgz (3,622 bytes)
...done: 3,622 bytes
downloading PHP_CodeCoverage-1.1.1.tgz ...
Starting to download PHP_CodeCoverage-1.1.1.tgz (132,339 bytes)
...done: 132,339 bytes
downloading PHP_Timer-1.0.2.tgz ...
Starting to download PHP_Timer-1.0.2.tgz (3,686 bytes)
...done: 3,686 bytes
downloading PHPUnit_MockObject-1.1.1.tgz ...
Starting to download PHPUnit_MockObject-1.1.1.tgz (19,897 bytes)
...done: 19,897 bytes
downloading YAML-1.0.6.tgz ...
Starting to download YAML-1.0.6.tgz (10,010 bytes)
...done: 10,010 bytes
downloading PHP_TokenStream-1.1.2.tgz ...
Starting to download PHP_TokenStream-1.1.2.tgz (9,797 bytes)
...done: 9,797 bytes
install ok: channel://pear.phpunit.de/File_Iterator-1.3.1
install ok: channel://pear.phpunit.de/Text_Template-1.1.1
install ok: channel://pear.phpunit.de/PHP_Timer-1.0.2
install ok: channel://pear.symfony-project.com/YAML-1.0.6
install ok: channel://pear.phpunit.de/PHP_TokenStream-1.1.2
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-1.1.1
install ok: channel://pear.phpunit.de/PHPUnit_MockObject-1.1.1
install ok: channel://pear.phpunit.de/PHPUnit-3.6.10
8.查看phpunit版本,成功~
phpunit -V
G:\xampp\php>phpunit -V
PHPUnit 3.6.10 by Sebastian Bergmann.
unrecognized option -- V
安装XAMPP,自动会安装pear和PHPUnit 但是,版本会很低,需要进行升级,我写一下我的升级步骤。
假设我的XAMPP 安装在G盘
1.进入DOS ,进入 G/XAMPP/PHP目录(如果把 G/xampp/php添加到环境变量就不用进入指定文件夹了)。
2.升级pear
pear upgrade pear
XamPP <wbr>安装/升级PHPUnit
G:\xampp\php>pear upgrade pear
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p
ear.php.net" to update
pear/Console_Getopt requires PEAR Installer (version >= 1.8.0), installed versio
n is 1.7.2
downloading PEAR-1.9.4.tgz ...
Starting to download PEAR-1.9.4.tgz (296,332 bytes)
..............................done: 296,332 bytes
downloading Archive_Tar-1.3.8.tgz ...
Starting to download Archive_Tar-1.3.8.tgz (17,995 bytes)
...done: 17,995 bytes
downloading Structures_Graph-1.0.4.tgz ...
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)
...done: 30,318 bytes
upgrade ok: channel://pear.php.net/Archive_Tar-1.3.8
ERROR: unable to unpack C:\Users\lmm\AppData\Local\Temp\pear\download\Structures
_Graph-1.0.4.tgz
upgrade ok: channel://pear.php.net/PEAR-1.9.4
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
3.查看pear版本
pear -V
G:\xampp\php>pear -V
PEAR Version: 1.9.4
PHP Version: 5.3.5
Zend Engine Version: 2.3.0
Running on: Windows NT LMM-PC 6.1 build 7601 (Unknow Windows version Home Basic
Edition Service Pack 1) i586
4.升级phpUnit发现失败。
pear upgrade pear/phpUnit
G:\xampp\php>pear upgrade pear/phpUnit
pear/phpUnit is already installed and is the same as the released version 1.3.2
upgrade failed
5.需要卸载原来的版本
pear uninstall pear/phpUnit
G:\xampp\php>pear uninstall pear/phpUnit
uninstall ok: channel://pear.php.net/PHPUnit-1.3.2
6.设置频道
pear config-set auto_discover 1
pear channel-discover components.ez.no
pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
G:\xampp\php>pear config-set auto_discover 1
config-set succeeded
G:\xampp\php>pear channel-discover components.ez.no
Adding Channel "components.ez.no" succeeded
Discovery of channel "components.ez.no" succeeded
G:\xampp\php>pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded
G:\xampp\php>pear channel-discover pear.symfony-project.com
Adding Channel "pear.symfony-project.com" succeeded
Discovery of channel "pear.symfony-project.com" succeeded
7.安装phpunit
pear install --alldeps phpunit/PHPUnit
G:\xampp\php>pear install --alldeps phpunit/PHPUnit
phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2
.0.5)
phpunit/PHP_Invoker requires PHP extension "pcntl"
downloading PHPUnit-3.6.10.tgz ...
Starting to download PHPUnit-3.6.10.tgz (118,595 bytes)
..........................done: 118,595 bytes
downloading File_Iterator-1.3.1.tgz ...
Starting to download File_Iterator-1.3.1.tgz (5,157 bytes)
...done: 5,157 bytes
downloading Text_Template-1.1.1.tgz ...
Starting to download Text_Template-1.1.1.tgz (3,622 bytes)
...done: 3,622 bytes
downloading PHP_CodeCoverage-1.1.1.tgz ...
Starting to download PHP_CodeCoverage-1.1.1.tgz (132,339 bytes)
...done: 132,339 bytes
downloading PHP_Timer-1.0.2.tgz ...
Starting to download PHP_Timer-1.0.2.tgz (3,686 bytes)
...done: 3,686 bytes
downloading PHPUnit_MockObject-1.1.1.tgz ...
Starting to download PHPUnit_MockObject-1.1.1.tgz (19,897 bytes)
...done: 19,897 bytes
downloading YAML-1.0.6.tgz ...
Starting to download YAML-1.0.6.tgz (10,010 bytes)
...done: 10,010 bytes
downloading PHP_TokenStream-1.1.2.tgz ...
Starting to download PHP_TokenStream-1.1.2.tgz (9,797 bytes)
...done: 9,797 bytes
install ok: channel://pear.phpunit.de/File_Iterator-1.3.1
install ok: channel://pear.phpunit.de/Text_Template-1.1.1
install ok: channel://pear.phpunit.de/PHP_Timer-1.0.2
install ok: channel://pear.symfony-project.com/YAML-1.0.6
install ok: channel://pear.phpunit.de/PHP_TokenStream-1.1.2
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-1.1.1
install ok: channel://pear.phpunit.de/PHPUnit_MockObject-1.1.1
install ok: channel://pear.phpunit.de/PHPUnit-3.6.10
8.查看phpunit版本,成功~
phpunit -V
G:\xampp\php>phpunit -V
PHPUnit 3.6.10 by Sebastian Bergmann.
unrecognized option -- V
很赞哦! (0)
相关文章
文章评论
-
-
-
0条评论