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

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

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: 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 Master Branch:
      MDL-37354-master

      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

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Mar/13