用pear来安装phpunit
【今日推荐】:为什么一到面试就懵逼!>>> 安装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-