在zend server EC 5.3下安装Pear和PHPUnit----[windows版]

1)安装好Zend Server EC5.3
安装在C:/Program Files/Zend
2)修改C:/Program Files/Zend/ZendServer/bin的go-pear.bat 文件
修改后的内容是:
@ECHO OFF
set PHP_BIN=php.exe
rem %PHP_BIN% -d output_buffering=0 PEAR/go-pear.phar
%PHP_BIN% -d phar.require_hash=0 PEAR/go-pear.phar
pause
3)双击运行go-pear.bat
4)在cmd窗口下
pear upgrade all
5)安装phpunit
在cmd窗口下
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install phpunit/PHPUnit
 
6)修改php.ini
修改php.ini
找到include_path把C:/Program Files/Zend/ZendServer/bin/PEAR加到后面
重启apache
phpunit可以使用了.
7)测试phpunit
新建立test.php放在C:/Program Files/Zend/Apache2/htdocs下面.
test.php的内容:
<?php
class ArrayTest extends PHPUnit_Framework_TestCase {
public function testNewArrayIsEmpty() {
    /*Create the Array fixture*/
    $fixture = array();
    /* Assert that the size of the Array * fixture is 0*/
    $this->assertEquals(0, sizeof($fixture));
}
public function testArrayContainsAnElement() {
    /* Create the Array fixture*/
    $fixture = array();
    /*Add an element to the Array * fixture*/
    $fixture[] = 'Element';
    /*Assert that the size of the * Array fixture is 1*/
    $this->assertEquals(1, sizeof($fixture));
}
}
?>
在cmd窗口下
cd /d C:/Program Files/Zend/Apache2/htdocs
phpunit test.php
可以看到phpunit的测试结果.
PHPUnit 3.5.6 by Sebastian Bergmann.
..
Time: 0 seconds, Memory: 3.00Mb
OK (2 tests, 2 assertions)
..说明测试成功.
把test.php的$this->assertEquals(0, sizeof($fixture));修改为$this->assertEquals(1, sizeof($fixture));
再测试
phpunit test.php
得到的结果
PHPUnit 3.5.6 by Sebastian Bergmann.
F.
Time: 0 seconds, Memory: 3.00Mb
There was 1 failure:
1) ArrayTest::testNewArrayIsEmpty
Failed asserting that <integer:0> matches expected <integer:1>.
C:/Program Files/Zend/Apache2/htdocs/test.php:7
FAILURES!
Tests: 2, Assertions: 2, Failures: 1.
 
说明测试发现有错误.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值