moodleou / moodle-mod_forumng

ForumNG forum module for Moodle
19 stars 20 forks source link

Cannot redeclare class mod_forumng_context_access #40

Closed mwuttke closed 9 years ago

mwuttke commented 9 years ago

Hello Jason,

Moodle (2.6.6 - Build: 20141110) ForumNG (MOODLE_26_STABLE - Version 2014073000) DB: PostgreSQL (9.1)

I tested moodle with phpunittest and the following error occurred. Do you have any idea what is wrong?

Thanks & Greetings, Michael

/srv/lmsmoodle# vendor/bin/phpunit --testdox-html phpunittest.html Moodle 2.6.6 (Build: 20141110), pgsql, 7720bdf4ff5a5ac7be633206f05a27d55325d521 PHP Fatal error: Cannot redeclare class mod_forumng_context_access in /srv/lmsmoodle/mod/forumng/mod_forumng.php on line 5194 PHP Stack trace: PHP 1. {main}() /srv/lmsmoodle/vendor/phpunit/phpunit/composer/bin/phpunit:0 PHP 2. PHPUnit_TextUI_Command::main() /srv/lmsmoodle/vendor/phpunit/phpunit/composer/bin/phpunit:63 PHP 3. PHPUnit_TextUI_Command->run() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129 PHP 4. PHPUnit_TextUI_Command->handleArguments() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:138 PHP 5. PHPUnit_Util_Configuration->getTestSuiteConfiguration() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:657 PHP 6. PHPUnit_Util_Configuration->getTestSuite() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:797 PHP 7. PHPUnit_Framework_TestSuite->addTestFiles() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:873 PHP 8. PHPUnit_Framework_TestSuite->addTestFile() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:416 PHP 9. PHPUnit_Util_Fileloader::checkAndLoad() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:355 PHP 10. PHPUnit_Util_Fileloader::load() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Util/Fileloader.php:76 PHP 11. include_once() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Util/Fileloader.php:92

Fatal error: Cannot redeclare class mod_forumng_context_access in /srv/lmsmoodle/mod/forumng/mod_forumng.php on line 5194

Call Stack: 0.0004 225184 1. {main}() /srv/lmsmoodle/vendor/phpunit/phpunit/composer/bin/phpunit:0 0.0068 561864 2. PHPUnit_TextUI_Command::main() /srv/lmsmoodle/vendor/phpunit/phpunit/composer/bin/phpunit:63 0.0069 562488 3. PHPUnit_TextUI_Command->run() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129 0.0069 564896 4. PHPUnit_TextUI_Command->handleArguments() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:138 2.3809 56216184 5. PHPUnit_Util_Configuration->getTestSuiteConfiguration() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:657 8.8508 181626592 6. PHPUnit_Util_Configuration->getTestSuite() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:797 8.8518 181628960 7. PHPUnit_Framework_TestSuite->addTestFiles() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:873 8.9131 184445352 8. PHPUnit_Framework_TestSuite->addTestFile() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:416 8.9142 184446336 9. PHPUnit_Util_Fileloader::checkAndLoad() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:355 8.9143 184446456 10. PHPUnit_Util_Fileloader::load() /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Util/Fileloader.php:76 8.9341 184777496 11. include_once('/srv/lmsmoodle/mod/forumng/tests/forumng_test.php') /srv/lmsmoodle/vendor/phpunit/phpunit/PHPUnit/Util/Fileloader.php:92

jason-platts commented 9 years ago

Thanks for the report.

This is fixed in MASTER already: https://github.com/moodleou/moodle-mod_forumng/commit/d62c8eaa228cfa24fd42be858a1a20df6e514d9e

mwuttke commented 9 years ago

Hello Jason, thanks a lot for your quick response , but what was the reason for this issue and could you fix it for MOODLE_26_STABLE as well?

Thanks & Greetings, Michael

jason-platts commented 9 years ago

If you look in the commit you'll see that the reason for the issue is that there was a use of 'require' rather than 'require_once' in some of the unit test code.

Unfortunately it can't be fixed in the stable branch - this is a limitation of the way we push from our development repository to github (we only push code released to our live servers to the branches, and this fix was not applied - we are also stopping support for 2.6 at the end of the month as we only support releasing patches to the latest branch and our 2.7 version will be available then). You should be able to cherry pick the commit to your own local copy of the branch.

mwuttke commented 9 years ago

Hello Jason,

thanks a lot for your quick answer & and your patient explanation. ;-)

I will try to make a cheery pick. ;-)

Thanks & Greetings, Michael