[FLOW3-general] PHPUnit problems: Bug #10428 related or new bug?
Robert Lemke
robert at typo3.org
Tue Oct 26 09:50:06 CEST 2010
Hi Martin,
Am 25.10.2010 um 14:01 schrieb Martin Eisengardt:
> Some minutes before You created a new issue: [http://forge.typo3.org/issues/10428]
>
> However there seems to be another problem related to the aop proxy classes the aop framework generates. For example aop generates the following file:
> [...]
> class Bootstrap_AOPProxy_Development extends \F3\FLOW3\Core\Bootstrap implements \F3\FLOW3\AOP\ProxyInterface { [...]} __halt_compiler();0 %CLASS%F3_FLOW3_Core_Bootstrap6728
>
> Doing PHPUnit tests for every class that has a aop proxy and activating code coverage causes problems with my installation. PHPUnit deeply inside tries to interpret everything after __halt_compiler. It now detects an incomplete class called 'F3_FLOW3_Core_Bootstrap6728' which results in a notice later on (endLine in classinfo array was not set). The notice causes an exception to be thrown in my installation.
>
> I changed PHPUnit/Util/File.php, lines 246-150 to:
> switch ($tokens[$i][0]) { case T_HALT_COMPILER: { return; } break; case T_NAMESPACE: {
> $currentNamespace = $tokens[$i+2][1];
> I do not know if a newer version of PHPUnit already fixes the problem. I am still using alpha11. Can you verify this bug? Is this a new bug or is it related to #10428?
Seems like you're really doing functional tests and not unit tests. Please be aware that unit tests should only focus on a singles class or method and should by no means use a real object manager, AOP framework, proxy class or the like.
You can perfectly unit-test aspects by instantiating the aspect class and using a mock JoinPoint - but don't try to use the real AOP framework in that scope.
On the other hand, if you really need functional tests, you can do so with the new functional test support. Check out the functional test for AOP in the FLOW3 package (that's brand new, only available in HEAD). I will write some related documentation before the next release.
Cheers,
Robert
More information about the FLOW3-general
mailing list