Note that there are some explanatory texts on larger screens.

plurals
  1. POErrors when testing with PHPUnit 3.5
    primarykey
    data
    text
    <p>After installing phpUnit 3.5 i am trying to run my tests this way:</p> <pre><code>phpunit AllTests.php </code></pre> <p>But I am getting the following errors:</p> <pre><code>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 </code></pre> <p>This is the contents of my AllTests.php</p> <p>And here is the contents of Alltests.php</p> <pre><code> &lt;?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-&gt;addTest(SF_Unit_AllTests::suite()); return $suite; } } if (PHPUnit_MAIN_METHOD == 'AllTests::main') { AllTests::main(); } </code></pre> <p>And here is the Unit/AllTests.php file</p> <pre><code>&lt;?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-&gt;addTestSuite('ModelAbstractTest'); $suite-&gt;addTestSuite('EventTest'); //$suite-&gt;addTestSuite('UserTest'); //$suite-&gt;addTestSuite('Authentication') return $suite; } } if (PHPUnit_MAIN_METHOD == 'SF_Unit_AllTests::main') { SF_Unit_AllTests::main(); } </code></pre> <hr> <p>TestHelper.php</p> <pre><code>/** * 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-&gt;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-&gt;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()-&gt;addDirectoryToBlacklist("$root/tests"); PHP_CodeCoverage_Filter::getInstance()-&gt;addDirectoryToBlacklist("$root/library/Zend"); </code></pre> <hr> <p>Any Idea's?</p> <p><strong>Update</strong></p> <p>I have added /usr/share/php to my include path. Now I am getting a different error:</p> <pre><code>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 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload