注意:为了生成控制器测试存根,需要PHPUnit

时间:2011-12-13 06:45:10

标签: php zend-framework

这是我在终端上的命令,我收到了一条通知消息

Note: PHPUnit is required in order to generate controller test stubs.

volition@volition-H61M-DS2:/var/www/register$ zf create action root Authentication

Note: PHPUnit is required in order to generate controller test stubs.

Creating an action named root inside controller at /var/www/register/application/controllers/AuthenticationController.php
Updating project profile '/var/www/register/.zfproject.xml'
Creating a view script for the root action method at /var/www/register/application/views/scripts/authentication/root.phtml
Updating project profile '/var/www/register/.zfproject.xml'

这是我的include_path:

include_path    .:/usr/share/php:/usr/share/pear

我不知道我在这里做错了什么。

而且我想知道phpUnit有什么用?

2 个答案:

答案 0 :(得分:1)

它就是它所说的。如果要创建测试存根,则需要安装PHPUnit。 Zend可以在您生成代码时自动为您创建测试。它不是错误或通知(如E_NOTICE中所述),它只是注意

PHPUnit是一个单元测试框架,可以帮助您测试代码。如果您不知道这意味着什么,请务必阅读PHPUnit documentation

答案 1 :(得分:-2)

First, install PEAR.

sudo apt-get install php-pear
Next, tell PEAR to update its own channel.

sudo pear channel-update pear.php.net
Then, tell PEAR to upgrade itself to the newest version.

sudo pear upgrade-all
You should now have the newest version of PEAR installed.

To install PHPUnit, let PEAR know where to find PHPUnit.

sudo pear channel-discover pear.phpunit.de
Then install PHPUnit. (the -a makes sure all dependency packages are also installed)

sudo pear install -a phpunit/PHPUnit

更新

最后重启Apache

sudo /etc/init.d/apache2 restart
你正在使用zend Framework

phpunit is installed in 
C:\Zend\ZendServer\bin\PEAR

添加此行

include_path=".:/usr/share/php:/usr/share/pear:/usr/share/php/PHPunit:/usr/share/php/PEAR"