【问题标题】:CakePHP requires PHPunit frameworkCakePHP 需要 PHPunit 框架
【发布时间】:2017-04-24 18:21:42
【问题描述】:

我的机器上有一个 CakePHP 应用程序。我只是从 svn 存储库下载它(所以,不是作曲家或梨安装)。 PHPunit 全局安装在我的机器上。因此,当我尝试测试某些模型时,例如:cake test app Model/SomeModel 我收到此错误:

Warning Error: include(PHPUnit/Autoload.php): failed to open stream: No such file or directory in [/var/www/html/shaufel_batch/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php, line 146]

Warning Error: include(): Failed opening 'PHPUnit/Autoload.php' for inclusion (include_path='/var/www/html/shaufel_batch/lib:.:/Users/admin/pear/share/pear:/php/includes:/usr/bin:/usr/lib/php/:/usr/share/php') in [/var/www/html/shaufel_batch/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php, line 146]

Error: Please install PHPUnit framework (http://www.phpunit.de)
#0 /var/www/html/shaufel_batch/lib/Cake/Console/ShellDispatcher.php(206): TestShell->initialize()
#1 /var/www/html/shaufel_batch/lib/Cake/Console/ShellDispatcher.php(66): ShellDispatcher->dispatch()
#2 /var/www/html/shaufel_batch/app/Console/cake.php(36): ShellDispatcher::run(Array)
#3 {main}

那么我该如何在刚刚从 svn 存储库下载的应用程序中解决这个问题?谢谢你的时间。我的 CakePHP 版本是 2.4.4

【问题讨论】:

  • 您使用的是什么操作系统?基本上,你只需要安装 php-unit。在 Debian/Ubuntu 系统上,您可以运行 apt-get install phpunit。查看您发布的链接:phpunit.de/manual/current/en/installation.html
  • @varlogtim,我使用的是 Ubuntu 16.04,我就是这样做的,我在帖子中写道,Phpunit 已全局安装在我的机器上
  • @varlogtim,谢谢,我只需要重新安装 phpunit,现在一切正常
  • 如果您通过 SNV 签出项目,这并不意味着您不能使用 composer。您甚至可以通过添加 composer.json 文件并关注 book.cakephp.org/2.0/en/installation/… Composer 来设置一个旧项目来使用 composer 将为您节省大量时间和麻烦。
  • @burzum,谢谢你的回复,我去看看。

标签: php unit-testing cakephp


【解决方案1】:

在 Debian/Ubuntu 系统上,您可以运行 apt-get install phpunit

其他系统:http://phpunit.de/manual/current/en/installation.html

【讨论】:

  • 谢谢,我只需要重新安装phpunit,现在一切正常
猜你喜欢
  • 1970-01-01
  • 2013-05-22
  • 2013-02-14
  • 1970-01-01
  • 2011-12-13
  • 1970-01-01
  • 1970-01-01
  • 2015-06-05
  • 2012-06-08
相关资源
最近更新 更多