1. 08 May, 2022 1 commit
    • Eloy Lafuente's avatar
      MDL-74413 phpunit: Move more tests to use correct names and namespaces · caf55abf
      Eloy Lafuente authored
      Applied the following changes to various testcase classes:
      
      - Namespaced with component[\level2-API]
      - Moved to level2-API subdirectory when required.
      - Fixed incorrect use statements with leading backslash.
      - Remove file phpdoc block
      - Remove MOODLE_INTERNAL if not needed.
      - Changed code to point to global scope when needed.
      - Fix some relative paths and comments here and there.
      - All them passing individually.
      - Complete runs passing too.
      
      Special mention to:
      
      - Moved to the level2 "privacy" namespace:
        - \mod_assign\privacy\feedback_legacy_polyfill_test
        - \mod_assign\privacy\submission_legacy_polyfill_test
      
      - Moved to the level2 "task" namespace:
        - \core_message\task\migrate_message_data_test
        - \ltiservice_gradebookservices\task\cleanup_test
        - \message_email\task\send_email_test
        - \mod_lti\task\clean_access_tokens_test
        - \mod_workshop\task\cron_task_test
      
      - Moved to the level2 "event" namespace:
        - \core_h5p\event\deleted_test
        - \core_h5p\event\viewed_test
      
      - Renamed to a better name:
        - backup_forum_activity_task_test.php (missing "task")
      caf55abf
  2. 13 Apr, 2022 1 commit
  3. 25 Mar, 2022 1 commit
  4. 22 Jan, 2022 1 commit
    • Eloy Lafuente's avatar
      MDL-73485 phpunit: externallib, generator and filter tescase names · 100bc51f
      Eloy Lafuente authored
      All externallib_test, generator_test and filter_test classes:
      
      - Namespaced with component[\level2-API]
      - Moved to level2-API subdirectory when required.
      - Fixed incorrect use statements with leading backslash.
      - Changed code to point to global scope when needed.
      - Fix some relative paths and comments here and there.
      - All them passing individually.
      - Complete runs passing too.
      
      Special mention to tests under testing/tests:
      
      1) The core_testing component doesn't exist.
      2) But testing/tests are allowed because there is a suite pointing to it (phpunit.xml).
      3) So, the only possible namespace for them is "core".
      4) And to avoid problems with other core testcases (under lib/tests)
         they have been renamed to have testing_xxxx as prefix.
      
      Finally, also modified calendar/tests/events/events_test.php because it uses
      some renamed (core_calendar_externallib_testcase => \core_calendar\externallib_test)
      classes.
      100bc51f
  5. 18 Jan, 2022 1 commit
  6. 14 Jan, 2022 1 commit
    • Eloy Lafuente's avatar
      MDL-73476 phpunit: events, external and search tescase names · 0c53a3de
      Eloy Lafuente authored
      All events_test, external_test and search_test classes:
      
      - Namespaced with component[\level2-API]
      - Moved to level2-API subdirectory when required.
      - Fixed incorrect use statements with leading backslash.
      - Changed code to point to global scope when needed.
      - Fix some relative paths and comments here and there.
      - All them passing individually.
      - Complete runs passing too.
      
      Special mention to lib/external/tests/external_test.php:
      - external is not a valid component
      - hence, its only valid namespace is "core"
      - also, it's testing lib/external/externallib.php
      - hence, the file (and class) have been renamed to external_externallib_test.php
        (to avoid conflicts with other external_test that may exist in core)
      0c53a3de
  7. 13 Jan, 2022 1 commit
  8. 12 Jan, 2022 1 commit
  9. 30 Dec, 2021 1 commit
    • Eloy Lafuente's avatar
      MDL-73352 phpunit: lib_test and locallib_test testcase names · 511801cb
      Eloy Lafuente authored
      All lib_test and locallib_test classes:
      
      - Namespaced with component (and API whenever makes sense).
      - Fixed incorrect use statements with leading backslash.
      - Changed code to point to global scope when needed or add new uses.
      - All them passing individually.
      - Complete runs passing too.
      
      Special mention to tests under login/tests:
      
      1) The core_login component doesn't exist.
      2) But login/tests are allowed because there is a suite pointing to it (phpunit.xml).
      3) So, the only possible namespace for them is "core".
      4) And to avoid problems with other core testcases (under lib/tests)
         they have been renamed to have login_xxxx as prefix.
      511801cb
  10. 29 Dec, 2021 1 commit
  11. 17 Dec, 2021 2 commits
    • Eloy Lafuente's avatar
      MDL-73348 phpunit: normalize all privacy provider tests · e4a2d9c1
      Eloy Lafuente authored
      As far as now all them have correct privacy level2 namespace:
      - Move them to "privacy" subdir.
      - Rename the files to "provider_test.php", this includes old
        privacy_test.php and privacy_provider_test.php files
      - Rename the testcase to provider_test too (to match file name)
      
      Also, change some relative paths and comments to point to new
      locations.
      e4a2d9c1
    • Eloy Lafuente's avatar
      MDL-73348 phpunit: privacy and privacy_provider testcase names · 57e6fb7a
      Eloy Lafuente authored
      All privacy_test and privacy_provider_test classes:
      
      - Namespaced with component\privacy.
      - Fixed incorrect use statements with leading backslash.
      - Changed code to point to global scope when needed.
      - Renamed a few files to make all be privacy_test or privacy_provider_test.php
      - All them passing individually.
      - Complete runs passing too.
      57e6fb7a
  12. 23 Nov, 2021 1 commit
  13. 19 Nov, 2021 1 commit
  14. 26 Oct, 2021 1 commit
    • Eloy Lafuente's avatar
      MDL-72871 cleanup: Remove incorrect whitespace from codebase · fdc2dcf2
      Eloy Lafuente authored
      Differences can be checked with git diff --ignore-all-space and
      that will show that the only non-whitespace change is in a test
      in the git lib/tests/html2text_test.php file. In that case the
      whitespace has been replaced by a quoted string (of whitespaces)
      keeping the test 100% equivalent and workarrounding the whitespace.
      fdc2dcf2
  15. 11 Oct, 2021 1 commit
  16. 09 Jul, 2021 1 commit
  17. 12 May, 2021 1 commit
    • Eloy Lafuente's avatar
      MDL-71583 versions: Add all the missing full-stops to version/requires · 9d6aa399
      Eloy Lafuente authored
      It seems that the new phpcs3 checker is now controlling those
      line comments that previously were ignored.
      
      This commit just looks for all the cases and bulk-add
      them when needed. The bash script (mac) used to add all them is:
      
      while read -r line; do
          arr=(${line//:/ })
          if [[ -n ${arr[0]} ]] && [[ -n ${arr[1]} ]]; then
              echo "  file ${arr[0]}, line ${arr[1]}"
              sed -i "${arr[1]}s/\$/\./" ${arr[0]}
          fi
      done < <(find . -name version.php | xargs ag --nomultiline '>(version|requires) *=.*//.*[^;\.]$')
      9d6aa399
  18. 31 Mar, 2021 1 commit
    • sam marshall's avatar
      MDL-71215 core_user: User fields - remaining deprecated functions · 611e2569
      sam marshall authored
      This change removes references in code and comments to a few
      deprecated functions that were accidentally missed in the larger
      change.
      
      The code changes only affect service_users.php. I made it support
      custom user profile fields in this query, because it was easy
      enough, rather than adding another TODO to fix later.
      611e2569
  19. 25 Mar, 2021 1 commit
  20. 16 Mar, 2021 12 commits
    • David Mudrák's avatar
      MDL-67748 admin: Add Behat tests for tokens filtering features · 4a9f8649
      David Mudrák authored
      
      
      Credit goes to Andrew for Behat data generators for webservices.
      Co-authored-by: default avatarAndrew Nicols <andrew@nicols.co.uk>
      4a9f8649
    • David Mudrák's avatar
      MDL-67748 admin: Do not show missing capabilities for mobile app service · b0fd376d
      David Mudrák authored
      We used to display capabilities like "Manage any calendar entries",
      "Delete evidence", "Manage competency frameworks", "View hidden courses"
      and others as "Missing capabilities" for the mobile app service tokens.
      
      This gave dangerous impression that the app will not work for students
      without these capabilities granted. There are known cases of admins who
      started to grant all these caps to the Authenticated user role because
      they were afraid the app would not work for them.
      
      The problem here is that the official mobile app service includes some
      functions that have these capabilities declared as required. But they
      are not really required to use the app. Either the app makes its own
      clever checks of capabilities before calling the functions, or sometimes
      the capabilities are not even correctly declared.
      
      It is safer for everybody to display this information for custom
      services only where the risk of the falsely missing caps is lower and
      the information is more accurate.
      
      Also, the help text has been improved so it does not suggest that these
      capabilities must be always added. We do not know why the service has
      them declared. In some cases, a service has capabilities declared just
      because it makes use of them in the if-then fashion.
      
      Additionally, the patch also displays the service short name because it
      is actually needed to know.
      b0fd376d
    • David Mudrák's avatar
      MDL-67748 admin: Show user identity fields on the manage tokens page · 6ea3588d
      David Mudrák authored
      On sites with many users, the fullname itself may not be unique
      identifier of users. Display the user identity fields below the token
      owner's name.
      6ea3588d
    • David Mudrák's avatar
      MDL-67748 admin: Add filter to the WS tokens management page · c4ad1bf2
      David Mudrák authored
      The patch adds ability to filter the list of token by the token value,
      the user and the service. Also the button to create a new token is made
      more prominent and easier to spot.
      c4ad1bf2
    • David Mudrák's avatar
    • David Mudrák's avatar
      MDL-67748 admin: Refactor tokens management as an external page · 2c177ae4
      David Mudrák authored
      No need to have a dedicated admin_setting_managewebservicetokens admin
      setting subclass, and yet do not use almost any of its features. So the
      patch merges the list and the forms handling into a single external
      page.
      
      Similarly, it feels like overkill to have a renderer method for a
      simple confirmation widget - especially given that the URLs were
      hard-coded in it. So that one was dropped.
      2c177ae4
    • David Mudrák's avatar
      MDL-67748 admin: Improve the display of missing capabilities · 596b0bb2
      David Mudrák authored
      The patch improves the display of the missing capabilities on the Manage
      tokens page and the Select authorised users page. The list of
      capabilities is rendered in a collapsible area and does not occupy too
      much space by default.
      
      Additionally on the later page, the patch improves the display of the
      list of existing authorised users so that it respects the configured
      identity fields.
      596b0bb2
    • David Mudrák's avatar
      MDL-67748 admin: Improve get_missing_capabilities_by_users() · c07f15d7
      David Mudrák authored
      The previous implementation falsely reported all implicit capabilities
      inherited from the authenticated user archetype. That caused a lot of
      capabilities reported as missing, even if they were correctly granted.
      
      This new implementation uses a different logic. Instead of seeking for
      explicitly assigned capabilities, it searches for capabilities that are
      not assigned to any of the user's role across the system.
      
      Please refer to the inline documentation. This should be still used for
      informative reports only, not for actual permissions evaluation. The
      context has been ignored here, as well as all the overrides etc. This
      patch just makes it a lesser evil.
      c07f15d7
    • David Mudrák's avatar
      MDL-67748 admin: Simplify the webservice token form · 0bcaab32
      David Mudrák authored
      We can now use the autocomplete element to select the user. No need to
      for the legacy behaviour.
      0bcaab32
    • David Mudrák's avatar
    • David Mudrák's avatar
    • David Mudrák's avatar
      MDL-67748 admin: Move the web services under the server administration · 2bf6db2d
      David Mudrák authored
      I suppose the original reasoning was that the web services protocols are
      pluggable and that plugins can provide external function. But those are
      not good reasons to put the whole Web services section under plugins.
      Web services are not a plugin type and they always felt very
      counter-intuitive there.
      
      From the server administrtaion perspective, web services are similar to
      scheduled tasks and therefore, they should live in the same section.
      2bf6db2d
  21. 12 Mar, 2021 2 commits
    • Eloy Lafuente's avatar
      MDL-71036 phpunit: Coding style changes, 99% whitespace only · 713722c3
      Eloy Lafuente authored
      I've gone over a few of the mofified files (those
      which were showing warnings and errors to CiBoT. Some of them
      have been fixed completely, while others only have fixed
      for the lines belonging to this issue (lib/tests/moodlelib_test.php)
      for example.
      713722c3
    • Eloy Lafuente's avatar
      MDL-71036 phpunit: Mock->setMethods() silently deprecated · 81407f18
      Eloy Lafuente authored
      The current ->setMethods() has been silently (won't emit any
      warning) in PHPUnit 9. And will stop working (current plans)
      in PHPUnit 10.
      
      Basically the now deprecated method has been split into:
      
      - onlyMethods(): To point to existing methods in the mocked artifact.
      - addMethods(): To point to non existing (yet) methods in the mocked
        artifact.
      
      In practice that means that all our current setMethods() calls can be
      converted to onlyMethods() (existing) and done. The addMethods() is
      mostly useful on development phases, not final testing.
      
      Finally note that <null> isn't accepted anymore as parameter to
      double all the methods. Instead empty array [] must be used.
      
      Link: https://github.com/sebastianbergmann/phpunit/issues/3770
      81407f18
  22. 10 Mar, 2021 1 commit
    • sam marshall's avatar
      MDL-45242 Lib: Replace calls to deprecated functions · 558cc1b8
      sam marshall authored
      In all cases changes have been kept to a minimum while not making
      the code completely horrible. For example, there are many instances
      where it would probably be better to rewrite a query entirely, but
      I have not done that (in order to reduce the risk of changes).
      558cc1b8
  23. 03 Dec, 2020 1 commit
  24. 21 Oct, 2020 1 commit
    • Eloy Lafuente's avatar
      MDL-67673 phpunit: Fix the return type of template methods · f6711bb3
      Eloy Lafuente authored
      All the setup/teardown/pre/post/conditions template methods
      now are required to return void. This was warned with phpunit 7
      and now is enforced.
      
      At the same time, fix a few wrong function names,
      provider data and param types, return statements...
      f6711bb3
  25. 26 Sep, 2020 1 commit
  26. 23 Sep, 2020 1 commit
  27. 18 Aug, 2020 1 commit
    • Eloy Lafuente's avatar
      MDL-69475 versions: bump all versions and requires in master · fbb07675
      Eloy Lafuente authored
      version = 2021052500 release version
      requires= 2021052500 same than version
      
      Why 20210525? (25th May 2021) ?
      
      Because master is going to be Moodle 4.0, to be released
      on November 2021. And, until then, we are going to have
      a couple of "intermediate" releases:
      
      - Moodle 3.10 to be released 9th November 2020. (2020110900)
      
        This version will be using versions from today to 2020110900
        (once it's released the YYYYMMDD part stops advancing).
      
      - Moodle 3.11 to be released 10th May 2021. (2021051000)
      
        This version will be using versions from 3.10 release to 2021051000
        (once it's released the YYYYMMDD part stops advancing).
      
      That means that all versions from today to 2021051000 are going
      to be used by those 2 "intermediate" releases (3.10 and 3.11).
      
      And we cannot use them in master, because it's forbidden to have
      any overlapping of versions between branches (or different upgrade
      paths will fail).
      
      So, get that 2021051000, let's add it a couple o...
      fbb07675