Forums / Developer / Unit testing

Unit testing

Author Message

Jean-Luc Chassaing

Friday 29 October 2010 1:44:00 am

Hello every one,

I really need some help or I'll get crazy !

I want to make some unit testing on my bran new code. Never done it before with phpunit and I just wanted to test it.

I've looked around the forum, by the way, a tutorial would be a great thing on this site, so I found out what to do looking at various topics.

So I first had a look at ezpedia. Installed PhpUnit with pear and downloaded the tests folder from github.

all this looks good. BUT !!

I'm just trying to run a simple test to see if all works right :

php test/runtest.php --list-tests

but my problem come here I get a fatal error saying

Fatal error:  Class 'PHPUnit_Runner_BaseTestRunner' not found in /usr/lib/php/PHPUnit/TextUI/TestRunner.php on line 59

I know it's not directly related to ezpublish but if someone could give me a clue, it would be great !

Jean-Luc Chassaing

Friday 29 October 2010 2:58:23 am

OK let me give here some more things.

I've fixed my previous problem by adding a require_once in the runtest.php file.

But There's something I still can't get through. looks like I'm not using the right phpunit release !??

here's the error message I'm getting now :

Call to undefined method PHPUnit_Util_Filter::addDirectoryToFilter() in runtest.php on line 22

but in fact the addDirectoryToFilter method doesn't exist in PHPUnit/Util/Filter.php where the PHPUnit_Util_Filter class is declared.

I thought using unit test would be easy but I' m wasting my time trying to fix does problems..

Any help would really be great !

André R.

Friday 29 October 2010 3:28:38 am

Our unit testing code is not yet compatible with 3.5 because of some bc (Backward compatibility) issues.

See sdk-public mailing list archive, there was a thread about it with possible patches a few weeks back.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Heath

Friday 29 October 2010 5:39:30 am

http://lists.ez.no/pipermail/sdk-public/2010-October/003185.html

and

http://lists.ez.no/pipermail/sdk-public/2010-October/003187.html

cheers,

Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Jean-Luc Chassaing

Friday 29 October 2010 6:45:32 am

Tank you for the help...

Well I found out that there is something more with the 3.5.x release the :

PHPUnit_Util_Filter::addDirectoryToFilter( getcwd() . '/tests' );

can't be used, the addDirectoryTyFilter method has been removed. It has to be replaced by :

PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(getcwd() . '/tests');

but the fact is I think I've all messed it up...

I'm trying to downgrade to an older release 3.4 but now the test/runtest.php script is insulting me telling that an unexpected error has occurred ... that's great !