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

All APIs should be listed in code

XMLWordPrintable

    • MOODLE_311_STABLE
    • MOODLE_402_STABLE
    • Hide

      JSON schema validation

      1. Connect to https://www.jsonschemavalidator.net
      2. In the "Select schema" box (left), copy the contents of the lib/apis.schema.json file.
      3. In the "Input JSON" box (right), copy the contents of the lib/apis.json file.
      4. Verify that you get a green text with message:
        "√ No errors found. JSON validates against the schema"

      Normal tests

      1. Install a MOODLE_311_STABLE site and create a course in the site.
      2. Verify that the file core_component.php has been created under the "site dataroot/cache" directory. Annotate its size and date.
      3. Verify that it contains both the 'subsystems' array and the 'plugins' array. (quotes includes in the search)
      4. Verify that it does not contain the 'apis' array. (quotes includes in the search)
      5. Switch to the master branch and upgrade, via web, the site to it (4.1dev).
      6. Verify that there isn't any notice/warning/error shown along the upgrade process related with the core_component.php file.
      7. Verify that the file core_component.php exists in the "site dataroot/cache" directory. Annotate its size and date.
      8. Verify that the size is now bigger (~100Kb) and the date has been updated.
      9. Verify that it contains both the 'subsystems' array and the 'plugins' array. (quotes includes in the search)
      10. Verify that, now, it also contain the 'apis' array (quotes includes in the search), with 'access' being the first element.
      11. Wait 1 minute (yes, 60 seconds).
      12. Delete the core_component.php file.
      13. Visit the site main page.
      14. Verify the the core_component.php file has been created again. Annotate its size and date.
      15. Verify that the size is the same than the 2nd annotation and the date has been updated.
      16. Verify that it contain the 'apis' array (quotes includes in the search) with 'access' being the first element.

      Tests using alternative component cache.

      1. Install a MOODLE_400_SITE with this setting added to your config.php file:
        $CFG->alternative_component_cache = $CFG->dataroot . '/mdl71096_cache.php';
      2. Verify that the file mdl71096_cache.php has been created under the "site dataroot" directory. Annotate its size and date.
      3. Verify that it does not contain the 'apis' array. (quotes includes in the search)
      4. Switch to the master branch and visit http://your.site.url/my
      5. Depending of your debugging settings you may see some PHP Warning about "Undefined array key "apis"". That's ok. Also if you don't see them.
      6. Verify that you are redirected to http://your.site.url/admin/index.php and there, you see the error: "Outdated component cache file defined in $CFG->alternative_component_cache, can not continue"
      7. In the terminal, in the "moodle root directory" execute
        sudo php admin/cli/alternative_component_cache.php --rebuild
      8. Verify that the file mdl71096_cache.php under the "site dataroot" directory continues existing. Annotate its size and date.
      9. Verify that the size is now bigger (~100Kb) and the date has been updated.
      10. Verify that, now, it also contain the 'apis' array (quotes includes in the search), with 'access' being the first element.
      11. Reload the page (http://your.site.url/admin/index.php) in the browser.
      12. Verify that now it's possible to continue with the upgrade.
      13. Complete the upgrade.
      14. Wait 1 minute (yes, 60 seconds).
      15. Delete the mdl71096_cache.php file
      16. Visit the site main page.
      17. Verify the the mdl71096_cache.php file has been created again. Annotate its size and date.
      18. Verify that the size is the same than the 2nd annotation and the date has been updated.
      19. Verify that it contain the 'apis' array (quotes includes in the search), with 'access' being the first element.
      Show
      JSON schema validation Connect to https://www.jsonschemavalidator.net In the "Select schema" box (left), copy the contents of the lib/apis.schema.json file. In the "Input JSON" box (right), copy the contents of the lib/apis.json file. Verify that you get a green text with message: "√ No errors found. JSON validates against the schema" Normal tests Install a MOODLE_311_STABLE site and create a course in the site. Verify that the file core_component.php has been created under the "site dataroot/cache" directory. Annotate its size and date. Verify that it contains both the 'subsystems' array and the 'plugins' array. (quotes includes in the search) Verify that it does not contain the 'apis' array. (quotes includes in the search) Switch to the master branch and upgrade, via web, the site to it (4.1dev). Verify that there isn't any notice/warning/error shown along the upgrade process related with the core_component.php file. Verify that the file core_component.php exists in the "site dataroot/cache" directory. Annotate its size and date. Verify that the size is now bigger (~100Kb) and the date has been updated. Verify that it contains both the 'subsystems' array and the 'plugins' array. (quotes includes in the search) Verify that, now, it also contain the 'apis' array (quotes includes in the search), with 'access' being the first element. Wait 1 minute (yes, 60 seconds). Delete the core_component.php file. Visit the site main page. Verify the the core_component.php file has been created again. Annotate its size and date. Verify that the size is the same than the 2nd annotation and the date has been updated. Verify that it contain the 'apis' array (quotes includes in the search) with 'access' being the first element. Tests using alternative component cache. Install a MOODLE_400_SITE with this setting added to your config.php file: $CFG->alternative_component_cache = $CFG->dataroot . '/mdl71096_cache.php'; Verify that the file mdl71096_cache.php has been created under the "site dataroot" directory. Annotate its size and date. Verify that it does not contain the 'apis' array. (quotes includes in the search) Switch to the master branch and visit http://your.site.url/my Depending of your debugging settings you may see some PHP Warning about "Undefined array key "apis"". That's ok. Also if you don't see them. Verify that you are redirected to http://your.site.url/admin/index.php and there, you see the error: " Outdated component cache file defined in $CFG->alternative_component_cache, can not continue " In the terminal, in the "moodle root directory" execute sudo php admin/cli/alternative_component_cache.php --rebuild Verify that the file mdl71096_cache.php under the "site dataroot" directory continues existing. Annotate its size and date. Verify that the size is now bigger (~100Kb) and the date has been updated. Verify that, now, it also contain the 'apis' array (quotes includes in the search), with 'access' being the first element. Reload the page ( http://your.site.url/admin/index.php ) in the browser. Verify that now it's possible to continue with the upgrade. Complete the upgrade. Wait 1 minute (yes, 60 seconds). Delete the mdl71096_cache.php file Visit the site main page. Verify the the mdl71096_cache.php file has been created again. Annotate its size and date. Verify that the size is the same than the 2nd annotation and the date has been updated. Verify that it contain the 'apis' array (quotes includes in the search), with 'access' being the first element.

      At the moment, the authoritative list of APIs is defined in https://moodledev.io/docs/apis (formerly in https://docs.moodle.org/dev/Core_APIs) but this should really be codified into the repo. I’d suggest we add it into lib/components.json.

        1. Alternative_component_2.png
          Alternative_component_2.png
          305 kB
        2. Alternative_component_3.gif
          Alternative_component_3.gif
          65 kB
        3. Alternative_component_4.gif
          Alternative_component_4.gif
          448 kB
        4. Alternative_component.png
          Alternative_component.png
          318 kB
        5. error.png
          error.png
          13 kB
        6. generate_apis_json.php
          3 kB
        7. JSON_Validation.png
          JSON_Validation.png
          229 kB
        8. Normal_test_2.png
          Normal_test_2.png
          443 kB
        9. Normal_test_3.gif
          Normal_test_3.gif
          446 kB
        10. Normal_test.png
          Normal_test.png
          392 kB

            stronk7 Eloy Lafuente (stronk7)
            dobedobedoh Andrew Lyons
            Andrew Lyons Andrew Lyons
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 4 hours, 50 minutes
                1d 4h 50m

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