[TYPO3-dev] Shell execution of phpunit tests for typo3core
Christoph Koehler
christoph.koehler at gmail.com
Fri Sep 18 16:50:09 CEST 2009
On 9/18/09 2:01 AM, Andy Grunwald [wmdb] wrote:
> 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?
>
>
Good luck with that. We tried that a couple years back but never got the
TYPO3 environment to load properly. If I remember correctly, there were
also differences between running from PHP CLI and PHPUnit; something
about global arrays that have been made global with the "global"
keyword, not $GLOBALS[xxx]. The array seemed to not be there if running
inside PHPUnit, so the environment is never correctly set up.
If you guys can get it to work, more power to you! Let me know how to
get it to work!
The PHPUnit Trac doesn't work for me for some reason, but you should be
able to find the old tickets I submitted there.
Christoph
More information about the TYPO3-dev
mailing list