3

Using Symfony 2.0, I have a whole system working properly in localhost.

Now I've tried to to upload it to an Internet hosting. After working in some errors, I am stuck here:

Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /home/preparatest/www/Symfony/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php

(By the way, the class exists in that directory indeed).

Anybody passed through this?

NOTE: I am not particularly configuring PHPUnit. I guess it is just included within some Symfony bundle. I don't really know what it is for and I wouldn't mind, if possilbe, just to remove it completely.

UPDATE: This is the exact class that isn't working. Apparently it doesn't find the parent class \PHPUnit_Framework_TestCase. But, I insist, this is a package bundled within Symfony and works well in local. I don't see why it doesn't in remote :(

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * 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 <[email protected]>
 */
abstract class WebTestCase extends \PHPUnit_Framework_TestCase
{
    static protected $class;
    static protected $kernel;
6
  • 1
    If you do not know what PHPUnit_Framework_TestCase is for, you are strongly encouraged to have a look at phpunit.de and learn about Unit Testing. It will greatly enhance your coding. Commented Oct 8, 2012 at 9:29
  • No doubt I will :). But what I need so far is to make this run properly on the Internet ;) Commented Oct 8, 2012 at 9:47
  • Can you please elaborate on the circumstances of this error? Are you using the console? Just accessing the application via the web? And can you check if phpunit is installed on the remote machine. Commented Oct 8, 2012 at 10:05
  • Thank you for your interest. The circumstances are really simple. I have a Symfony2.0 project running well in my local Apache server. I upload to a hosting with PHP 5.3.2 and it just gives that error when trying to access to the URL with a browser. I don't see in the php.ini of the machine anything to do with PHPUnit... should I see something there about it?. Commented Oct 8, 2012 at 11:14
  • This is the complete error: [Mon Oct 08 11:42:50 2012] [error] [client 94.126.240.2] PHP Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /home/preparatest/www/Symfony/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php on line 24 Commented Oct 8, 2012 at 11:15

2 Answers 2

4

Ok, solved.

I removed all Test and Tests folders from my Bundles. Those where just intended to perform unit tests with Symfony... but i productions apparently PHPUnit is not installed.

Thanks a lot

Sign up to request clarification or add additional context in comments.

Comments

2

One wouldn't normally put test scripts onto the production server. But if you do need to run your tests there, and the tests rely on phpUnit (which they do), then you need to install phpUnit on that server. See http://phpUnit.de/ for download an install instructions.

You clearly already have phpUnit installed locally (whether you know it or not). Perhaps it was included in your PHP installation with whatever bundle/distro you're using.

1 Comment

Perfect! Thanks. And now... how do I take "my tests" out from production? Is there anything in Symfony to do so? I insist: No mean I developed or installed any test no in local or in remote. It just came within Symfony bundle. How do I disable that tests at least in production? Thanks again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.