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

Fix all (now) wrong namespace uses within **/tests directories

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.11.11, 4.0.5
    • 3.6.6, 3.7.2, 3.8, 3.9.17, 3.11.10, 4.0.4, 4.1
    • General, Unit tests
    • MOODLE_311_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • Hide

      General

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

      Testing instructions for 311, 400 and master

      1. Install local_codechecker in the site.
      2. Run this (this analyses all the test files in core having namespaces):

        find . -name "*_test.php" | \
            xargs grep -P -l '^namespace ' | \
            xargs local/codechecker/phpcs/bin/phpcs --standard=moodle --extensions=php \
            --sniffs=moodle.PHPUnit.TestCaseNames --report-width=132 && echo "ALL OK"
        

      3. Verify that there isn't any warning or error reported (empty output) and ALL OK is printed at the end.
      Show
      General Verify that complete PHPUnit runs are passing (GHA, ToBiC...) for all branches. Testing instructions for 311, 400 and master Install local_codechecker in the site. Run this (this analyses all the test files in core having namespaces): find . -name "*_test.php" | \ xargs grep -P -l '^namespace ' | \ xargs local/codechecker/phpcs/bin/phpcs --standard=moodle --extensions=php \ --sniffs=moodle.PHPUnit.TestCaseNames --report-width=132 && echo "ALL OK" Verify that there isn't any warning or error reported (empty output) and ALL OK is printed at the end.

      With MDLSITE-4800, rules about how to use namespaces within **/tests directories have been agreed

      Right now there are some uses in core violating that agreement:

      $ ag '^namespace' | grep _test.php
      blocks/html/tests/search_content_test.php:25:namespace block_html;
      admin/tool/httpsreplace/tests/httpsreplace_test.php:25:namespace tool_httpsreplace\tests;
      grade/grading/form/guide/tests/generator_test.php:26:namespace tests\gradingform_guide;
      grade/grading/form/rubric/tests/privacy_test.php:26:namespace tests\gradingform_rubric;
      grade/grading/form/rubric/tests/generator_test.php:26:namespace tests\gradingform_rubric;
      grade/grading/tests/generator_test.php:26:namespace tests\core_grading;
      search/tests/skip_future_documents_iterator_test.php:26:namespace core_search;
      search/tests/external_test.php:25:namespace core_search;
      webservice/soap/tests/wsdl_test.php:25:namespace webservice_soap;
      lib/form/tests/external_test.php:26:namespace core_form;
      lib/form/tests/filetypes_util_test.php:26:namespace core_form;
      mod/assign/tests/privacy_test.php:25:namespace mod_assign\tests;
      

      This issue is about to fix all them and make core compliant.

      Ciao

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Paul Holden Paul Holden
            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 - 4 hours, 13 minutes
                4h 13m

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