catalyst / moodle-tool_trigger

Like IFTTT for Moodle: events to trigger external services. https://moodle.org/plugins/tool_trigger
Other
44 stars 27 forks source link

The `tool_trigger_logdump_action_step_testcase` unit test is failing #159

Open golenkovm opened 3 years ago

golenkovm commented 3 years ago

Full error:

root@061f555b1326:/var/www/vanilla-moodle-39# vendor/bin/phpunit --testsuite='tool_trigger_testsuite' --filter='test_execute'
Moodle 3.9.11+ (Build: 20211112), 530c2ac613376fd5f4b3ef65843afa26bb08f11f
Php: 7.4.25, pgsql: 9.6.16, OS: Linux 5.4.0-89-generic x86_64
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

..................................F............                   47 / 47 (100%)

Time: 5.39 seconds, Memory: 101.00 MB

There was 1 failure:

1) tool_trigger_logdump_action_step_testcase::test_execute
Failed asserting that '/var/www/vanilla-moodle-39/admin/tool/trigger/classes/steps/actions/logdump_action_step.php:58:\n
array(17) {\n
  'eventname' =>\n
  string(31) "\core\event\user_profile_viewed"\n
  'component' =>\n
  string(4) "core"\n
  'action' =>\n
  string(6) "viewed"\n
  'target' =>\n
  string(12) "user_profile"\n
  'objecttable' =>\n
  string(4) "user"\n
  'objectid' =>\n
  string(1) "2"\n
  'crud' =>\n
  string(1) "r"\n
  'edulevel' =>\n
  int(0)\n
  'contextid' =>\n
  int(5)\n
  'contextlevel' =>\n
  int(30)\n
  'contextinstanceid' =>\n
  string(1) "2"\n
  'userid' =>\n
  int(0)\n
  'courseid' =>\n
  int(0)\n
  'relateduserid' =>\n
  string(1) "2"\n
  'anonymous' =>\n
  int(0)\n
  'other' =>\n
  array(3) {\n
    'courseid' =>\n
    int(1)\n
    'courseshortname' =>\n
    string(10) "short name"\n
    'coursefullname' =>\n
    string(9) "full name"\n
  }\n
  'timecreated' =>\n
  int(1636789859)\n
}\n
/var/www/vanilla-moodle-39/admin/tool/trigger/classes/steps/actions/logdump_action_step.php:59:\n
NULL\n
/var/www/vanilla-moodle-39/admin/tool/trigger/classes/steps/actions/logdump_action_step.php:60:\n
array(2) {\n
  'foo' =>\n
  string(3) "bar"\n
  'baz' =>\n
  string(3) "bax"\n
}\n
' contains "  ["eventname"]=>
  string(31) "\core\event\user_profile_viewed"
  ["component"]=>
  string(4) "core"
  ["action"]=>
  string(6) "viewed"
  ["target"]=>
  string(12) "user_profile"
  ["objecttable"]=>
  string(4) "user"
  ["objectid"]=>
  string(1) "2"".

/var/www/vanilla-moodle-39/admin/tool/trigger/tests/logdump_action_step_test.php:83
/var/www/vanilla-moodle-39/lib/phpunit/classes/basic_testcase.php:64

To re-run:
 vendor/bin/phpunit "tool_trigger_logdump_action_step_testcase" admin/tool/trigger/tests/logdump_action_step_test.php

FAILURES!
Tests: 47, Assertions: 248, Failures: 1.

Interesting that this isn't failing in all envs. I'll try to figure out more details on this

golenkovm commented 3 years ago

All right, this is failing with xdebug 3 installed. Also it prints:

Xdebug: [Config] The setting 'xdebug.overload_var_dump' has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.overload_var_dump (See: https://xdebug.org/docs/errors#CFG-C-REMOVED)
DaniCastel commented 4 months ago

Hi, I executed the test and this is the result

Php: 8.2.18, mysqli: 8.1.0, OS: Linux 6.5.0-15-generic aarch64
Class logdump_action_step_test could not be found in /var/www/html/admin/tool/trigger/tests/logdump_action_step_test.php

If we replace tool_trigger_logdump_action_step_testcase with tool_trigger_logdump_action_step_test, the test passes