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 !

eZ debug

Timing: Jan 17 2025 23:50:31
Script start
Timing: Jan 17 2025 23:50:31
Module start 'content'
Timing: Jan 17 2025 23:50:32
Module end 'content'
Timing: Jan 17 2025 23:50:32
Script end

Main resources:

Total runtime1.0422 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.9688180.8594
Module start 'content' 0.00570.9241 769.8281622.7031
Module end 'content' 0.92980.1124 1,392.5313337.3984
Script end 1.0422  1,729.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.3916210.0002
Check MTime0.00140.1374210.0001
Mysql Total
Database connection0.00060.054510.0006
Mysqli_queries0.964192.50782020.0048
Looping result0.00200.19012000.0000
Template Total1.013797.320.5068
Template load0.00200.190020.0010
Template processing1.011797.072820.5059
Template load and register function0.00010.008310.0001
states
state_id_array0.00130.129210.0013
state_identifier_array0.00070.065020.0003
Override
Cache load0.00170.1615450.0000
Sytem overhead
Fetch class attribute can translate value0.00130.127040.0003
Fetch class attribute name0.00100.091380.0001
XML
Image XML parsing0.00180.171540.0004
class_abstraction
Instantiating content class attribute0.00000.0018100.0000
General
dbfile0.00200.1912410.0000
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs