3

使用 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;
4

2 回答 2

4

好的,解决了。

我从我的捆绑包中删除了所有测试和测试文件夹。那些只是打算用 Symfony 执行单元测试的……但我的产品显然没有安装 PHPUnit。

非常感谢

于 2012-10-08T17:43:52.407 回答
2

通常不会将测试脚本放到生产服务器上。但是,如果您确实需要在那里运行测试,并且测试依赖于 phpUnit(他们这样做),那么您需要在该服务器上安装 phpUnit。有关下载安装说明,请参见http://phpUnit.de/ 。

您显然已经在本地安装了 phpUnit(无论您是否知道)。也许它与您使用的任何捆绑包/发行版一起包含在您的 PHP 安装中。

于 2012-10-08T12:11:36.547 回答