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

PHPUnit install should detect missing strings or bad capability names

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 5.0
    • Unit tests
    • MOODLE_500_STABLE
    • patch/MDL-85666-405
    • Hide

      Best tested by a developer

      1. Edit an accses.php file (e.g. admin/tool/customlang/db/access.php).
      2. Chance a capabilty name so that it is not of the expected form (e.g. 'tool/customlang:view' -> 'tool_customlang:view'.
      3. If you already have a PHPunit site installed, run php admin/tool/phpunit/cli/util.php --drop
      4. Run php admin/tool/phpunit/cli/init.php
      5. Verify that at the end of the install you get an exception telling you that 'tool_customlang:view'. (or whatever) is wrong.
      6. Put then access.php file back to how it was.
      7. Edit a language file (e.g. admin/tool/customlang/lang/en/tool_customlang.php)
      8. Delete the string for a capability. (E.g. delete the line $string['customlang:edit'] = 'Edit local translation'
      9. Run php admin/tool/phpunit/cli/util.php --drop
      10. Run php admin/tool/phpunit/cli/init.php
      11. Verify that at the end of the install you get an exception telling you that this capability has a missing string.
      Show
      Best tested by a developer Edit an accses.php file (e.g. admin/tool/customlang/db/access.php). Chance a capabilty name so that it is not of the expected form (e.g. 'tool/customlang:view' -> 'tool_customlang:view'. If you already have a PHPunit site installed, run php admin/tool/phpunit/cli/util.php --drop Run php admin/tool/phpunit/cli/init.php Verify that at the end of the install you get an exception telling you that 'tool_customlang:view'. (or whatever) is wrong. Put then access.php file back to how it was. Edit a language file (e.g. admin/tool/customlang/lang/en/tool_customlang.php) Delete the string for a capability. (E.g. delete the line $string ['customlang:edit'] = 'Edit local translation' Run php admin/tool/phpunit/cli/util.php --drop Run php admin/tool/phpunit/cli/init.php Verify that at the end of the install you get an exception telling you that this capability has a missing string.
    • Show
      Fails against automated checks. Checked MDL-85666 using repository: https://github.com/skodak/moodle.git MOODLE_405_STABLE (9 errors / 12 warnings) [branch: patch/MDL-85666-405 | CI Job ] overview (0/0) , phplint (0/0) , phpcs (9/12) , js (0/0) , css (0/0) , phpdoc (0/0) , commit (0/0) , savepoint (0/0) , thirdparty (0/0) , externalbackup (0/0) , grunt (0/0) , shifter (0/0) , mustache (0/0) , gherkin (0/0) , Should these errors be fixed? Built on: Fri Jun 13 08:56:28 UTC 2025

      I keep embarassing myself by making stupid mistakes, so I want to put some previous guardrails in place. I previously proposed MDLSITE-6404, but that is hard. Easier to do in Moodle code, so here is a proposed implementation.

            skodak Petr Skoda
            timhunt Tim Hunt
            Tim Hunt Tim Hunt
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.