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

用pear来安装phpunit

时间:2014-11-12 12:06:53      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:http   io   ar   sp   on   cti   bs   ad   as   

安装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,表示成功

基本过程结束


用pear来安装phpunit

标签:http   io   ar   sp   on   cti   bs   ad   as   

原文地址:http://my.oschina.net/surjur/blog/343438

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