码迷,mamicode.com
首页 > Web开发 > 详细

centos --- phpunit 安装过程

时间:2015-08-20 15:39:42      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:

安装pear 的命令如下:
$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar

pear 安装成功!


下面用 pear 来安装phpunit


pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com

pear upgrade-all
pear install phpunit/PHPUnit

在安装的过程中可能会出现依赖包,按照提示信息进行安装。
如:yum install php-dom -y等
例子:a.php
<?php
class StackTest extends PHPUnit_Framework_TestCase
{
    public function testPushAndPop()
    {
        $stack = array();
        $this->assertEquals(0, count($stack));
        array_push($stack, ‘foo‘);
        $this->assertEquals(‘foo‘, $stack[count($stack)-1]);
        $this->assertEquals(1, count($stack));
        $this->assertEquals(‘foo‘, array_pop($stack));
        $this->assertEquals(0, count($stack));
    }
?>
phpunit a.php 看到OK,表示成功
基本过程结束

centos --- phpunit 安装过程

标签:

原文地址:http://my.oschina.net/u/588516/blog/495048

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!