trampgeek / moodle-qtype_coderunner

CodeRunner: A moodle quiz question type that runs student-submitted program code in a sandbox to check if it satisfies a given set of tests.
GNU General Public License v2.0
207 stars 120 forks source link

Moodle 4.4 fatal error #217

Closed aspark21 closed 2 months ago

aspark21 commented 2 months ago

Moodle 4.4 PHP8.1 triggered during phpunit environment setup / install

 PHP Fatal error:  Uncaught coding_exception: Coding error detected, it must be fixed by a programmer: tests/fixtures/test-sandbox-config.php must exist to define test configuration in /var/www/html/question/type/coderunner/tests/test.php:63
    Stack trace:
    #0 /var/www/html/question/type/coderunner/tests/helper.php(30): qtype_coderunner_testcase::setup_test_sandbox_configuration()
    #1 /var/www/html/question/type/coderunner/tests/penaltyregime_test.php(34): require_once('/var/www/html/q...')
    #2 /var/www/html/vendor/phpunit/phpunit/src/Util/FileLoader.php(66): include_once('/var/www/html/q...')
    #3 /var/www/html/vendor/phpunit/phpunit/src/Util/FileLoader.php(49): PHPUnit\Util\FileLoader::load('/var/www/html/q...')
    #4 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php(398): PHPUnit\Util\FileLoader::checkAndLoad('/var/www/html/q...')
    #5 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php(537): PHPUnit\Framework\TestSuite->addTestFile('/var/www/html/q...')
    #6 /var/www/html/vendor/phpunit/phpunit/src/TextUI/TestSuiteMapper.php(67): PHPUnit\Framework\TestSuite->addTestFiles(Array)
    #7 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php(393): PHPUnit\TextUI\TestSuiteMapper->map(Object(PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection), '')
    #8 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php(114): PHPUnit\TextUI\Command->handleArguments(Array)
    #9 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php(99): PHPUnit\TextUI\Command->run(Array, true)
    #10 /var/www/html/vendor/phpunit/phpunit/phpunit(107): PHPUnit\TextUI\Command::main()
    #11 /var/www/html/vendor/bin/phpunit(122): include('/var/www/html/v...')
    #12 {main}
trampgeek commented 2 months ago

If you're running the CodeRunner testsuite, you need to define the test configuration, including what Jobe server you wish to test with.

In the fixtures folder you'll find a file test-sandbox-config-dist.php. You should copy that to test-sandbox-config.php and edit it for your own environment.