windows下手动安装phpunit
2011-02-22 17:57
225 查看
转自:http://www.cnblogs.com/awaken/archive/2009/11/26/1611155.html
相关组件下载:https://github.com/sebastianbergmann
文档:http://www.phpunit.de/manual/3.5/en/index.html
1、到http://pear.phpunit.de/get/ 去下载最新版本
2、 解压(推荐放在WAMP包下),将PHPUnit的路径加入php.ini 的include_path
3、修改phpunit.bat中 @phpbin@ 为php解析器位置(php.exe位置,如d:/wamp/php5/php.exe)
4、将phpunit.bat最后一行的路径修改为你的phpunit.php的路径(跟phpunit.bat在同一位置,如修改为:%PHPBIN% "D:/Wamp/PHPUnit/phpunit.php" %*),注意,是phpunit.php而不是phpunit
5、修改PHPUnit/Util/PHP.php,其中@php_bin@改为php.exe位置
OK,我们来验证是否正确安装:
写一个测试脚本,用官方的arraytest.php
1
<?php
2
require_once 'PHPUnit/Framework.php';
3
4
class StackTest extends PHPUnit_Framework_TestCase
5
{
6
public function testPushAndPop()
7
{
8
$stack = array();
9
$this->assertEquals(0, count($stack));
10
11
array_push($stack, 'foo');
12
$this->assertEquals('foo', $stack[count($stack)-1]);
13
$this->assertEquals(1, count($stack));
14
15
$this->assertEquals('foo', array_pop($stack));
16
$this->assertEquals(0, count($stack));
17
}
18
}
19
?>
命名为ArrayTest.php,放到d:/wamp/PHPUnit
进入命令行phpunit目录,执行 phpunit ArrayTest.php
输出: OK(1 test, 5 assertions)
对每个测试,PHPUnit命令行测试工具打印一个字符表示进程:
测试成功打印“.”。
运行测试方法发生了断言失败打印“F”。
运行测试方法发生了错误打印“E”。
相关组件下载:https://github.com/sebastianbergmann
文档:http://www.phpunit.de/manual/3.5/en/index.html
Whenever you are tempted to type something into a | ||||
--Martin Fowler |
2、 解压(推荐放在WAMP包下),将PHPUnit的路径加入php.ini 的include_path
3、修改phpunit.bat中 @phpbin@ 为php解析器位置(php.exe位置,如d:/wamp/php5/php.exe)
4、将phpunit.bat最后一行的路径修改为你的phpunit.php的路径(跟phpunit.bat在同一位置,如修改为:%PHPBIN% "D:/Wamp/PHPUnit/phpunit.php" %*),注意,是phpunit.php而不是phpunit
5、修改PHPUnit/Util/PHP.php,其中@php_bin@改为php.exe位置
OK,我们来验证是否正确安装:
写一个测试脚本,用官方的arraytest.php
1
<?php
2
require_once 'PHPUnit/Framework.php';
3
4
class StackTest extends PHPUnit_Framework_TestCase
5
{
6
public function testPushAndPop()
7
{
8
$stack = array();
9
$this->assertEquals(0, count($stack));
10
11
array_push($stack, 'foo');
12
$this->assertEquals('foo', $stack[count($stack)-1]);
13
$this->assertEquals(1, count($stack));
14
15
$this->assertEquals('foo', array_pop($stack));
16
$this->assertEquals(0, count($stack));
17
}
18
}
19
?>
命名为ArrayTest.php,放到d:/wamp/PHPUnit
进入命令行phpunit目录,执行 phpunit ArrayTest.php
输出: OK(1 test, 5 assertions)
对每个测试,PHPUnit命令行测试工具打印一个字符表示进程:
测试成功打印“.”。
运行测试方法发生了断言失败打印“F”。
运行测试方法发生了错误打印“E”。
相关文章推荐
- 手动安装phpunit
- 为 Windows 下的 PHP 安装 PEAR 和 PHPUnit
- [摘录]在windows下安装phpunit
- 在Windows下安装pear之后安装PHPUnit
- 在Windows下安装pear之后安装PHPUnit
- windows 2008手动安装PHP环境
- windows下安装PHPunit
- windows 7_64 免安装手动配置 Apaache2.2+mysql+PHP
- 在windows安装PHPUnit
- windows安装phpunit
- Windows环境下安装PHPUnit
- windows 下安装pear 和PHPUNIT
- [转]在Windows中安装PhpUnit
- 在Windows上手动安装php开发环境
- windows xampp下安装phpunit
- 在windows下安装phpunit
- phpunit windows 安装 配置
- windows下安装PEAR, PHPUnit
- windows安装PHP5.5+Apache2.4+Mysql5.5
- Windows下成功安装PHP+MYSQL+APACHE