Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.3.2

Bug #19038 tests run twice / main() not needed
Submitted: 2011-11-15 03:50 UTC
From: danielc Assigned: avb
Status: Closed Package: HTML_QuickForm2 (version SVN)
PHP Version: 5.4.0alpha1 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2011-11-15 03:50 UTC] danielc (Daniel Convissor)
Description: ------------ Hi: When calling "phpunit -d error_reporting=22527 tests/AllTests" the tests execute twice. This is due to the use of "PHPUnit_TextUI_TestRunner::run(self::suite());" in main(). Commenting out that line fixes the issue. The whole main() / PHPUnit_MAIN_METHOD stuff is unnecessary. I imagine that's left over from very old versions of PHPUnit. The running 2x becomes a problem because during the second round, the 63rd test causes a hang. Thanks, --Dan

Comments

 [2011-11-15 08:11 UTC] danielc (Daniel Convissor)
An example of a problem caused by the second running... phpunit -d error_reporting=22527 ./tests/QuickForm2/Controller/Action/AllTests.php 1) HTML_QuickForm2_Controller_Action_JumpTest::testBug3443 Constant SID already defined
 [2011-11-15 15:44 UTC] avb (Alexey Borzov)
-Status: Open +Status: Bogus
- Doctor, it hurts when I do it like this! - Don't do it like this, then. You should either run $ phpunit ./tests/QuickForm2/Controller/Action/ or $ php ./tests/QuickForm2/Controller/Action/AllTests.php both of these will run the suite once. Removing "the whole stuff" will, however, prevent the second form of invocation from running.
 [2011-12-10 22:24 UTC] danielc (Daniel Convissor)
I noticed your package also has a "tests-nomain" directory. FYI, I figured out a way to be able to have AllTests.php called by either PHP or PHPUnit and work right. See http://svn.php.net/viewvc/pear/packages/Tree/branches/Tree_0_3_0/tests/AllTests.php?view=markup
 [2014-06-19 19:06 UTC] avb (Alexey Borzov)
-Status: Bogus +Status: Closed -Assigned To: +Assigned To: avb
Updated AllTests.php to check whether they were invoked from phpunit, tests no longer run twice in such case. https://github.com/pear/HTML_QuickForm2/commit/733ece3c1f45e9176ca578bdc8e87e9e48ec7af4