• MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • Hide

      Important Note: the HEAD in the commands below assume that the branches have been integrated without any merge commit. You may need to replace them by the real commits if the issue has been integrated with merge commit. Here there are the commit details:

      • 311_STABLE:
        • HEAD = 65c883915788a8c187aa398df31d1bed33f37a96
      • 400_STABLE
        • HEAD = ad01614e9cbb12897820626fb473257534c8c3a9
      • master:
        • HEAD = 81f05b3239bcc2a5647bf81cfa8a405e3fced755

      A) General

      1. Verify that complete PHPUnit runs are passing (GHA, ToBiC...) for all branches.

      B) Testing instructions for 311, 400 and master

      1. Install local_codechecker in the site.
      2. Run this (see the important note above about the HEAD alternatives and commits):

        git show --pretty="" --name-only HEAD  | \
            xargs local/codechecker/phpcs/bin/phpcs --standard=moodle  --extensions=php  \
            --sniffs=moodle.PHPUnit.TestCaseNames,moodle.Files.MoodleInternal -p \
            && echo "Yay"
        

      3. Verify that you get 39 dots in the output, without any error and with "Yay" printed at the end.
      4. Init phpunit: php admin/tool/phpunit/cli/init.php
      5. Run this (see the important note above about the HEAD alternatives and commits):

        git show --pretty="" --name-only HEAD | grep '_test.php' | \
            xargs -n 1 -I {} bash -c "echo {}; vendor/bin/phpunit {} > /dev/null || echo ERROR"
        

      6. Verify that you don't get any "ERROR" output, that means that all the tests modified can be run individually.
        • Note: if you get an ERROR on lib/tests/environment_test.php it means you need to enable and increase your max_input_vars to 5000, for more information see this doc page
      7. Run this (see the important note above about the HEAD alternatives and commits):

        git show --pretty="" --name-only HEAD | \
            grep -v '/tests/.*_test.php'
        

      8. Verify that only TWO files are returned (they are 2 created fixtures that originally were within the test class):
        • lib/tests/fixtures/block_ablocktype.php
        • lib/tests/fixtures/testable_block_manager.php
      Show
      Important Note : the HEAD in the commands below assume that the branches have been integrated without any merge commit. You may need to replace them by the real commits if the issue has been integrated with merge commit. Here there are the commit details: 311_STABLE: HEAD = 65c883915788a8c187aa398df31d1bed33f37a96 400_STABLE HEAD = ad01614e9cbb12897820626fb473257534c8c3a9 master: HEAD = 81f05b3239bcc2a5647bf81cfa8a405e3fced755 A) General Verify that complete PHPUnit runs are passing (GHA, ToBiC...) for all branches. B) Testing instructions for 311, 400 and master Install local_codechecker in the site. Run this (see the important note above about the HEAD alternatives and commits): git show --pretty="" --name-only HEAD | \ xargs local/codechecker/phpcs/bin/phpcs --standard=moodle --extensions=php \ --sniffs=moodle.PHPUnit.TestCaseNames,moodle.Files.MoodleInternal -p \ && echo "Yay" Verify that you get 39 dots in the output, without any error and with "Yay" printed at the end. Init phpunit: php admin/tool/phpunit/cli/init.php Run this (see the important note above about the HEAD alternatives and commits): git show --pretty="" --name-only HEAD | grep '_test.php' | \ xargs -n 1 -I {} bash -c "echo {}; vendor/bin/phpunit {} > /dev/null || echo ERROR" Verify that you don't get any "ERROR" output, that means that all the tests modified can be run individually. Note: if you get an ERROR on lib/tests/environment_test.php it means you need to enable and increase your max_input_vars to 5000, for more information see this doc page Run this (see the important note above about the HEAD alternatives and commits): git show --pretty="" --name-only HEAD | \ grep -v '/tests/.*_test.php' Verify that only TWO files are returned (they are 2 created fixtures that originally were within the test class): lib/tests/fixtures/block_ablocktype.php lib/tests/fixtures/testable_block_manager.php

      This corresponds to the progress of point B of MDL-71049.

      In this case applied to more testcases, they are a bunch, so no worth listing them like in previous issues that were for testcases with many repetitions.

      I'll be creating a few (5-6) issues like this to advance with the remaining cases (80-100 files on each) to keep it more or less manageable (review, rebase...).

      Changes include:

      • Add or fix namespaces to be correct component ones. With sub-namespaces when the tests belong to a known API.
      • Fixing incorrect use \xxx statements with leading backslash.
      • Remove file phpdoc blocks.
      • Remove MOODLE_INTERNAL if not needed.
      • Changing code to point to global scope when needed (when referencing to classes belonging to other components) or adding new use xxx statements (for classes corresponding to the same component/area).
      • Change testcase class names to match file name (_test.

      Goals:

      • Verify that there aren't remaining files and classes to be processed.
      • Verify that all the files can be run individually.
      • Verify that complete runs continue passing ok.
      • Apply the changes to both 311 (where PHPUnit was introduced) and master.

      Notes:

      • The changes should be 99.99% contained within phpunit /tests/ files. If something out from there is detected, it will be handled in separate commit, with justifications.

        1. MDL-75716_master_1.png
          MDL-75716_master_1.png
          38 kB
        2. MDL-75716_master_2.png
          MDL-75716_master_2.png
          174 kB
        3. MDL-75716_v311_1.png
          MDL-75716_v311_1.png
          41 kB
        4. MDL-75716_v311_2.png
          MDL-75716_v311_2.png
          170 kB
        5. MDL-75716_v400_1.png
          MDL-75716_v400_1.png
          48 kB
        6. MDL-75716_v400_2.png
          MDL-75716_v400_2.png
          174 kB

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Tim Hunt Tim Hunt
            Jun Pataleta Jun Pataleta
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours, 1 minute
                6h 1m

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