【发布时间】:2012-10-08 09:27:04
【问题描述】:
使用 Symfony 2.0,我的整个系统在 localhost 中正常工作。
现在我尝试将其上传到 Internet 托管。在遇到一些错误后,我被困在这里:
Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /home/preparatest/www/Symfony/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php
(顺便说一句,该类确实存在于该目录中)。
有人通过了吗?
注意:我没有特别配置 PHPUnit。我猜它只是包含在一些 Symfony 包中。我真的不知道它是做什么用的,如果可能的话,我不介意将它完全删除。
更新:这是不工作的确切类。显然它没有找到父类\PHPUnit_Framework_TestCase。但是,我坚持认为,这是一个捆绑在 Symfony 中的包,并且在本地运行良好。我不明白为什么它不在远程:(
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\Test;
use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpKernel\HttpKernelInterface;
/**
* WebTestCase is the base class for functional tests.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class WebTestCase extends \PHPUnit_Framework_TestCase
{
static protected $class;
static protected $kernel;
【问题讨论】:
-
如果您不知道
PHPUnit_Framework_TestCase的用途,强烈建议您查看phpunit.de 并了解单元测试。它将大大增强您的编码。 -
毫无疑问我会:)。但到目前为止,我需要的是让它在互联网上正常运行;)
-
您能否详细说明此错误的情况?你在用控制台吗?只是通过网络访问应用程序?你能检查一下远程机器上是否安装了phpunit吗?
-
感谢您的关注。情况真的很简单。我有一个 Symfony2.0 项目在我的本地 Apache 服务器上运行良好。我使用 PHP 5.3.2 上传到主机,它只是在尝试使用浏览器访问 URL 时给出了该错误。我在机器的 php.ini 中没有看到与 PHPUnit 有任何关系...我应该在那里看到一些关于它的东西吗?。
-
这是完整的错误:[Mon Oct 08 11:42:50 2012] [error] [client 94.126.240.2] PHP Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /home/prepparatest/ www/Symfony/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php 第 24 行