Moodle
  1. Moodle
  2. MDL-37354

Test return values cleaning process for all existing external function unit test

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.4, 2.4.1, 2.5
    • Fix Version/s: 2.3.5, 2.4.2
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide

      All branches:
      phpunit core_user_external_testcase user/tests/externallib_test.php
      phpunit core_course_external_testcase course/tests/externallib_test.php

      2.4/2.5 only:
      phpunit core_enrol_external_testcase enrol/tests/externallib_test.php
      phpunit core_group_external_testcase group/tests/externallib_test.php
      phpunit core_external_testcase lib/external/tests/externallib_test.php
      phpunit core_message_external_testcase message/tests/externallib_test.php //this will fail for a different issue (ignore it)
      phpunit mod_assign_external_testcase mod/assign/tests/externallib_test.php
      phpunit core_notes_external_testcase notes/tests/externallib_test.php
      phpunit core_webservice_external_testcase webservice/tests/externallib_test.php

      Show
      All branches: phpunit core_user_external_testcase user/tests/externallib_test.php phpunit core_course_external_testcase course/tests/externallib_test.php 2.4/2.5 only: phpunit core_enrol_external_testcase enrol/tests/externallib_test.php phpunit core_group_external_testcase group/tests/externallib_test.php phpunit core_external_testcase lib/external/tests/externallib_test.php phpunit core_message_external_testcase message/tests/externallib_test.php //this will fail for a different issue (ignore it) phpunit mod_assign_external_testcase mod/assign/tests/externallib_test.php phpunit core_notes_external_testcase notes/tests/externallib_test.php phpunit core_webservice_external_testcase webservice/tests/externallib_test.php
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull 2.4 Branch:
      MDL-37354-stable24
    • Pull Master Branch:
      MDL-37354-master
    • Rank:
      46975

      Description

      You need to add the following line to all externallib PHPunit tests:

      external_api::clean_returnvalue(COMPONENT_external::FUNCTION_NAME_returns(), $returnvalue);
      

      Reference: http://docs.moodle.org/dev/Web_Services_Unit_Test#How_to_write_an_external_function_PHPUnit_test

        Issue Links

          Activity

          Hide
          Damyon Wiese added a comment -

          There are going to be a few that slip though the cracks here - all the webservices that have been sent for integration review but not integrated yet.

          Show
          Damyon Wiese added a comment - There are going to be a few that slip though the cracks here - all the webservices that have been sent for integration review but not integrated yet.
          Hide
          Damyon Wiese added a comment -

          Note - I found you updated the webservice documentation here:

          http://docs.moodle.org/dev/Web_Services_Unit_Test

          Peer Review checklist:

          [W] Syntax - Warnings about comment formatting (missing full stops)
          [-] Output
          [Y] Whitespace
          [-] Language
          [-] Databases
          [N] Testing - Can you put in the list of command lines to run the unit tests for the affected files?
          [-] Security
          [Y] Documentation
          [Y] Git
          [Y] Sanity check

          Thanks - Damyon

          Show
          Damyon Wiese added a comment - Note - I found you updated the webservice documentation here: http://docs.moodle.org/dev/Web_Services_Unit_Test Peer Review checklist: [W] Syntax - Warnings about comment formatting (missing full stops) [-] Output [Y] Whitespace [-] Language [-] Databases [N] Testing - Can you put in the list of command lines to run the unit tests for the affected files? [-] Security [Y] Documentation [Y] Git [Y] Sanity check Thanks - Damyon
          Hide
          Jérôme Mouneyrac added a comment -

          Thanks Damyon. I fixed the full stop issues and added the phpunit test instructions, submitting to integration.

          Show
          Jérôme Mouneyrac added a comment - Thanks Damyon. I fixed the full stop issues and added the phpunit test instructions, submitting to integration.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Apart from a resolved conflict in master with some recently introduced @ message/tests/externallib_test.php, looks ok so...

          integrated (23, 24 & master), thanks!

          Offtopic: Has this been documented somewhere? I'm adding the dev_docs_required label just in case.

          Show
          Eloy Lafuente (stronk7) added a comment - Apart from a resolved conflict in master with some recently introduced @ message/tests/externallib_test.php, looks ok so... integrated (23, 24 & master), thanks! Offtopic: Has this been documented somewhere? I'm adding the dev_docs_required label just in case.
          Hide
          Jérôme Mouneyrac added a comment -

          Yesy I actually changed the doc before making the commit: http://docs.moodle.org/dev/Web_Services_Unit_Test, you can pass it

          Show
          Jérôme Mouneyrac added a comment - Yesy I actually changed the doc before making the commit: http://docs.moodle.org/dev/Web_Services_Unit_Test , you can pass it
          Hide
          Ankit Agarwal added a comment -

          All good,
          Passing thanks

          Show
          Ankit Agarwal added a comment - All good, Passing thanks
          Hide
          Dan Poltawski added a comment -

          Hurray! We did it! Thanks to all the reporters, testers, user and watchers for a bumper week of Moodling!

          Show
          Dan Poltawski added a comment - Hurray! We did it! Thanks to all the reporters, testers, user and watchers for a bumper week of Moodling!

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: