Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-55330

Improve error message from deprecated Event API



    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.1
    • None
    • Events API
    • Easy


      I have a plugin which which defined an event handler for the mod_created event using the old Event API. In a core unit test, something happened causing an event to be triggered, causing the following output:

      Debugging: Events API using $handlers array has been deprecated in favour of Events 2 API, please use it instead.
      * line 3938 of /lib/deprecatedlib.php: call to debugging()
      * line 4216 of /lib/deprecatedlib.php: call to events_dispatch()
      * line 809 of /lib/classes/event/base.php: call to events_trigger_legacy()
      * line 169 of /course/modlib.php: call to core\event\base->trigger()
      * line 266 of /lib/testing/generator/module_generator.php: call to add_moduleinfo()
      * line 61 of /mod/page/tests/generator/lib.php: call to testing_module_generator->create_instance()
      * line 502 of /lib/testing/generator/data_generator.php: call to mod_page_generator->create_instance()
      * line 192 of /lib/testing/tests/generator_test.php: call to testing_data_generator->create_module()
      * line ? of unknownfile: call to core_test_generator_testcase->test_create_module()
      * line 909 of /var/lib/jenkins/composer_base/ouvle/vendor/phpunit/phpunit/src/Framework/TestCase.php: call to ReflectionMethod->invokeArgs()
      * line 768 of /var/lib/jenkins/composer_base/ouvle/vendor/phpunit/phpunit/src/Framework/TestCase.php: call to PHPUnit_Framework_TestCase->runTest()
      * line 80 of /lib/phpunit/classes/advanced_testcase.php: call to PHPUnit_Framework_TestCase->runBare()
      * line 612 of /var/lib/jenkins/composer_base/ouvle/vendor/phpunit/phpunit/src/Framework/TestResult.php: call to advanced_testcase->runBare()
      * line 724 of /var/lib/jenkins/composer_base/ouvle/vendor/phpunit/phpunit/src/Framework/TestCase.php: call to PHPUnit_Framework_TestResult->run()
      * line 747 of /var/lib/jenkins/composer_base/ouvle/vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit_Framework_TestCase->run()
      * line 747 of /var/lib/jenkins/composer_base/ouvle/vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit_Framework_TestSuite->run()
      * line 747 of /var/lib/jenkins/composer_base/ouvle/vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit_Framework_TestSuite->run()
      * line 440 of /var/lib/jenkins/composer_base/ouvle/vendor/phpunit/phpunit/src/TextUI/TestRunner.php: call to PHPUnit_Framework_TestSuite->run()
      * line 149 of /var/lib/jenkins/composer_base/ouvle/vendor/phpunit/phpunit/src/TextUI/Command.php: call to PHPUnit_TextUI_TestRunner->doRun()
      * line 100 of /var/lib/jenkins/composer_base/ouvle/vendor/phpunit/phpunit/src/TextUI/Command.php: call to PHPUnit_TextUI_Command->run()
      * line 47 of /var/lib/jenkins/composer_base/ouvle/vendor/phpunit/phpunit/phpunit: call to PHPUnit_TextUI_Command::main()

      This stacktrace isn't very helpful, since it was triggered by the core code so doesn't indicate where the actual problem is. It would be good if the debugging message could be improved to include more information about how to find and fix the issue.




            Unassigned Unassigned
            marxjohnson Mark Johnson
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
            0 Vote for this issue
            2 Start watching this issue