eZ Community » Forums » Developer » Unit testing
expandshrink

Unit testing

Unit testing

Friday 29 October 2010 10:44:00 am - 4 replies

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 !

Modified on Friday 29 October 2010 10:54:56 am by Jean-Luc Chassaing

Friday 29 October 2010 11: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 !

Friday 29 October 2010 12:28:38 pm

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.

Friday 29 October 2010 2:39:30 pm

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

Friday 29 October 2010 3:45:32 pm

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 !

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from