[TYPO3-dev] Shell execution of phpunit tests for typo3core

Andy Grunwald [wmdb] andreas.grunwald at wmdb.de
Fri Sep 18 09:01:22 CEST 2009


Hey,

yesterday evening, i had a look at the unit tests of typo3. I detected, 
that all unit tests extend the class "tx_phpunit_testcase" of the TYPO3 
Extension phpunit [1] instead of "PHPUnit_Framework_TestCase" from 
PHPUnit [2].

if i know correctly, you could run this tests only with the TYPO3 
Extension "phpunit" and only from the backend of one TYPO3 instance.
I think thats not a very smart solution, because you couldn`t run this 
tests from a shell with a command like this "phpunit 
tests/t3lib/t3lib_div_testcase.php".

In my opinion it is okay, that the TYPO3 Extension extend the class 
"PHPUnit_Framework_TestCase" with the method 
"simulateFrontendEnviroment" [3]. But is it possible to create unit 
tests more modular that you can run this from a shell without a backend?
Some tests has a very long runtime and if you start them from a backend 
you could run in some timeouts.
I didn`t think that is this a solution to set the php timeout to "0".

The solution for this problem is to require all classes / files which 
you use in your unittest. For the file "t3lib_div_testcase.php" it would 
be "t3lib_div" and "tx_phpunit_testcase".
The "problem" is that at this time no constants like "PATH_site" or 
something else available.
Another disadvantage to this solution is the fact, that you must have 
installed the TYPO3 extension "phpunit".

If i know correctly, with the TER / trunk on forge version of TYPO3 
extension "phpunit", it is not possible to check core unit tests from 
the backend [4] [5].

What do you think about this topic?

Have a nice day!

[1] http://typo3.org/extensions/repository/view/phpunit/current/
[2] http://www.phpunit.de/
[3] 
http://typo3.org/extensions/repository/view/phpunit/current/info/class.tx_phpunit_testcase.php/
[4] http://forge.typo3.org/issues/show/3349
[5] 
http://lists.netfielders.de/pipermail/typo3-team-core/2009-January/022753.html




More information about the TYPO3-dev mailing list