Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1112585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:44:06+00:00 2026-05-17T02:44:06+00:00

After installing phpUnit 3.5 i am trying to run my tests this way: phpunit

  • 0

After installing phpUnit 3.5 i am trying to run my tests this way:

phpunit AllTests.php

But I am getting the following errors:

PHP Fatal error:  Class 'PHPUnit_TextUI_TestRunner' not found in /usr/share/php/PHPUnit/TextUI/Command.php on line 140
Fatal error: Class 'PHPUnit_TextUI_TestRunner' not found in /usr/share/php/PHPUnit/TextUI/Command.php on line 140

This is the contents of my AllTests.php

And here is the contents of Alltests.php

      <?php
    if (!defined('PHPUnit_MAIN_METHOD')) {
        define('PHPUnit_MAIN_METHOD', 'AllTests::main');
    }

    /**
     * TestHelper
     */
    require_once 'TestHelper.php';

    /**
     * @see SF_Unit_AllTests
     */
    require_once 'unit/AllTests.php';

    class AllTests
    {
        public static function main()
        {
            $parameters = array();

            PHPUnit_TextUI_TestRunner::run(self::suite(), $parameters);
        }

        public static function suite()
        {
            $suite = new PHPUnit_Framework_TestSuite('EventManager');

            $suite->addTest(SF_Unit_AllTests::suite());

            return $suite;
        }
    }

    if (PHPUnit_MAIN_METHOD == 'AllTests::main') {
        AllTests::main();
    }

And here is the Unit/AllTests.php file

<?php
if (!defined('PHPUnit_MAIN_METHOD')) {
    define('PHPUnit_MAIN_METHOD', 'SF_Unit_AllTests::main');
}

/**
 * Testhelper
 */
require_once dirname(__FILE__). '/../TestHelper.php';

/**
 * Include unit tests
 */
require_once('unit/Model/ModelAbstractTest.php');
require_once('unit/Model/EventTest.php');
//require_once('unit/Model/UserTest.php');
//require_once('unit/Model/AuthenticationTest.php);

/**
 * 
 * @author jigal
 *
 */
class SF_Unit_AllTests
{
    /**
     * 
     * @return unknown_type
     */
    public static function main()
    {
        PHPUnit_TextUI_TestRunner::run(self::suite());
    }

    /**
     * 
     * @return PHPUnit_Framework_TestSuite
     */
    public static function suite()
    {
        $suite = new PHPUnit_Framework_TestSuite('EventManager Unit tests');
        $suite->addTestSuite('ModelAbstractTest');
        $suite->addTestSuite('EventTest');
        //$suite->addTestSuite('UserTest');
        //$suite->addTestSuite('Authentication')
        return $suite;
    }


}

if (PHPUnit_MAIN_METHOD == 'SF_Unit_AllTests::main') {
    SF_Unit_AllTests::main();
}

TestHelper.php

/**
 * Get PHPUnit
 */
require_once 'PHPUnit/Autoload.php';


/*
 * Set error reporting level
 */
error_reporting( E_ALL | E_STRICT );

/**
 * Default timezone
 */
date_default_timezone_set('Europe/London');

/*
 * Set the include path
 */
    /*
 * Set the include path
 */

    $root  = realpath(dirname(__FILE__) . '/../');
    $paths = array(
        "/usr/share/php/",
        "$root/library/Incu",
        "$root/library",
        "$root/tests",
        "$root/application"
    );
    set_include_path(get_include_path() . PATH_SEPARATOR . implode(PATH_SEPARATOR, $paths))

;


defined('APPLICATION_PATH')
    or define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
defined('APPLICATION_ENV')
or define('APPLICATION_ENV', 'development');
    require_once 'Zend/Application.php';
/**
 * Autoloader helpers
 */
function _SF_Autloader_SetUp() 
{
    require_once 'Zend/Loader/Autoloader.php';

    $loader = Zend_Loader_Autoloader::getInstance();
    $loader->registerNamespace('SF_');
    $application = new Zend_Application(
            APPLICATION_ENV,
            APPLICATION_PATH.'/configs/events.ini'
    );

}

function _SF_Autloader_TearDown()
{
    Zend_Loader_Autoloader::resetInstance();
    $loader = Zend_Loader_Autoloader::getInstance();
    $loader->registerNamespace('SF_');
}

/**
 * Init autoloader
 */
_SF_Autloader_SetUp();

/**
 * Start session now!
 */
Zend_Session::$_unitTestEnabled = true;
Zend_Session::start();

/**
 * Ignore folders from code coverage etc
 */
//PHPUnit_Util_Filter::addDirectoryToFilter("$root/tests");
//PHPUnit_Util_Filter::addDirectoryToFilter("$root/library/Zend");


PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist("$root/tests");
PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist("$root/library/Zend");

Any Idea’s?

Update

I have added /usr/share/php to my include path.
Now I am getting a different error:

PHPUnit 3.5.0 by Sebastian Bergmann.

....PHP Fatal error:  Class 'PHPUnit_Framework_MockObject_Generator' not found in /usr/share/php/PHPUnit/Framework/TestCase.php on line 1049

Fatal error: Class 'PHPUnit_Framework_MockObject_Generator' not found in /usr/share/php/PHPUnit/Framework/TestCase.php on line 1049
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:44:06+00:00Added an answer on May 17, 2026 at 2:44 am

    Well, actually Laurent Laffont kind of provided the correct answer: incomplete MockObject installation.

    Per Installation Instructions you have to uninstall previous PHPUnit, before you will be able to install version 3.5

    But that seems not enough, you also have to uninstall extra packages (in this case PHPUnit_MockObjects) and only then install new verstion:

    pear uninstall phpunit/phpunit
    pear uninstall phpunit/PHP_MockObject
    pear install phpunit/phpunit
    

    And that reinstalled PHP_MockObject package with all necessary files in place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After installing collective.solr via buildout, I am getting the following error when attempting to
After installing export plugin i can not run grails application and get this java.lang.LinkageError:
I've been getting this error after installing rvm and rails with rvm. Can anyone
After installing OS X Mountain Lion and XCode, I'm getting this error: Jonathans-MacBook-Air:fme jong$
After installing rails3, I'm experiencing problems when trying to use haml with it. I
After installing Oracle XE DB and ODP.NET, i tried to run included scripts to
After installing Z3 V3.1, following SMT-LIB code is not working. It was quite good
After installing VS Sp1, the build breaks as it can't find LC.exe (to run
After installing fresh CUDA 4.0 drivers and SDK, many SDK tests fail (e.g. fastWalshTransform,
After installing Snow Leopard I got the following error when connecting to a remote

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.