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

Add phpunit generators for groups and groupings

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Unit tests
    • Labels:
    • Testing Instructions:
      Hide

      The new group and grouping generation methods arn't used in core presently, they have been added so that it is easier in the future to create groups and groupings.
      Because of this it is hard to test.
      In order to test it you must write a PHPunit test that makes use of phpunit_data_generator::create_group and phpunit_data_generator::create_grouping.
      This is a developer task.

      Show
      The new group and grouping generation methods arn't used in core presently, they have been added so that it is easier in the future to create groups and groupings. Because of this it is hard to test. In order to test it you must write a PHPunit test that makes use of phpunit_data_generator::create_group and phpunit_data_generator::create_grouping. This is a developer task.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-32426-master-1

      Description

      TODO:

      • create_group
      • create_groupings

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            dobedobedoh Andrew Nicols added a comment -

            I've written these functions to allow easier unit testing for the new group(ing) idnumber features

            Show
            dobedobedoh Andrew Nicols added a comment - I've written these functions to allow easier unit testing for the new group(ing) idnumber features
            Hide
            poltawski Dan Poltawski added a comment -

            Petr - one for you

            Show
            poltawski Dan Poltawski added a comment - Petr - one for you
            Hide
            skodak Petr Skoda added a comment -

            +1

            Show
            skodak Petr Skoda added a comment - +1
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Andrew, this has been integrated now.
            Just noting I did add an additional commit during integration to fix a typo in the phpdocs (@param array|stdClass $recrd).

            Cheers
            Sam

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Andrew, this has been integrated now. Just noting I did add an additional commit during integration to fix a typo in the phpdocs (@param array|stdClass $recrd). Cheers Sam
            Hide
            phalacee Jason Fowler added a comment -

            If a PHPUnit test is required to test this, shouldn't a phpunit test be written by the developer and included with the patch?

            Show
            phalacee Jason Fowler added a comment - If a PHPUnit test is required to test this, shouldn't a phpunit test be written by the developer and included with the patch?
            Hide
            poltawski Dan Poltawski added a comment -

            Jason: since you can't test the new functionality you can test for regressions by running the phpunit tests

            Show
            poltawski Dan Poltawski added a comment - Jason: since you can't test the new functionality you can test for regressions by running the phpunit tests
            Hide
            andyjdavis Andrew Davis added a comment -

            This needs clarification from the developer. I'm running all existing phpunit tests now but its really not up to me as the tester to guess decide whether that's adequate. I also don't have adequate knowledge of the code in question to be writing unit tests for it. Andrew Nicols, can you let me know whether running the existing tests is adequate? Did you want to take it back and add some unit tests yourself?

            Show
            andyjdavis Andrew Davis added a comment - This needs clarification from the developer. I'm running all existing phpunit tests now but its really not up to me as the tester to guess decide whether that's adequate. I also don't have adequate knowledge of the code in question to be writing unit tests for it. Andrew Nicols, can you let me know whether running the existing tests is adequate? Did you want to take it back and add some unit tests yourself?
            Hide
            andyjdavis Andrew Davis added a comment -

            Heres the output of the unit tests. I got failures but nothing mentioning groups.

            PHPUnit 3.6.10 by Sebastian Bergmann.

            Configuration read from /home/andrew/Desktop/code/moodle/int/master/phpunit.xml

            ............................................................. 61 / 1070 ( 5%)
            ................................FF........................... 122 / 1070 ( 11%)
            ............................................................. 183 / 1070 ( 17%)
            ............................................................. 244 / 1070 ( 22%)
            ...........................E................................. 305 / 1070 ( 28%)
            ............................................................. 366 / 1070 ( 34%)
            ............................................................. 427 / 1070 ( 39%)
            ............................................................. 488 / 1070 ( 45%)
            ............................................................. 549 / 1070 ( 51%)
            ............................................................. 610 / 1070 ( 57%)
            ............................................................. 671 / 1070 ( 62%)
            ............................................................. 732 / 1070 ( 68%)
            ............................................................. 793 / 1070 ( 74%)
            ............................................................. 854 / 1070 ( 79%)
            ............................................................. 915 / 1070 ( 85%)
            ............................................................. 976 / 1070 ( 91%)
            ............................................................. 1037 / 1070 ( 96%)
            .................................

            Time: 27:49, Memory: 257.75Mb

            There was 1 error:

            1) moodlelib_testcase::test_fix_utf8
            iconv(): Detected an illegal character in input string

            /home/andrew/Desktop/code/moodle/int/master/lib/moodlelib.php:1130
            /home/andrew/Desktop/code/moodle/int/master/lib/tests/moodlelib_test.php:315
            /home/andrew/Desktop/code/moodle/int/master/lib/phpunit/lib.php:1124

            There were 2 failures:

            1) dml_testcase::test_unique_index_collation_trouble
            Unique index is accent insensitive, this may cause problems for non-ascii languages. This is usually caused by accent insensitive default collation.

            /home/andrew/Desktop/code/moodle/int/master/lib/dml/tests/dml_test.php:3428

            2) dml_testcase::test_sql_binary_equal
            SQL operator "=" is expected to be case sensitive
            Failed asserting that 1 matches expected 2.

            /home/andrew/Desktop/code/moodle/int/master/lib/dml/tests/dml_test.php:3456

            FAILURES!
            Tests: 1070, Assertions: 20551, Failures: 2, Errors: 1.

            Show
            andyjdavis Andrew Davis added a comment - Heres the output of the unit tests. I got failures but nothing mentioning groups. PHPUnit 3.6.10 by Sebastian Bergmann. Configuration read from /home/andrew/Desktop/code/moodle/int/master/phpunit.xml ............................................................. 61 / 1070 ( 5%) ................................FF........................... 122 / 1070 ( 11%) ............................................................. 183 / 1070 ( 17%) ............................................................. 244 / 1070 ( 22%) ...........................E................................. 305 / 1070 ( 28%) ............................................................. 366 / 1070 ( 34%) ............................................................. 427 / 1070 ( 39%) ............................................................. 488 / 1070 ( 45%) ............................................................. 549 / 1070 ( 51%) ............................................................. 610 / 1070 ( 57%) ............................................................. 671 / 1070 ( 62%) ............................................................. 732 / 1070 ( 68%) ............................................................. 793 / 1070 ( 74%) ............................................................. 854 / 1070 ( 79%) ............................................................. 915 / 1070 ( 85%) ............................................................. 976 / 1070 ( 91%) ............................................................. 1037 / 1070 ( 96%) ................................. Time: 27:49, Memory: 257.75Mb There was 1 error: 1) moodlelib_testcase::test_fix_utf8 iconv(): Detected an illegal character in input string /home/andrew/Desktop/code/moodle/int/master/lib/moodlelib.php:1130 /home/andrew/Desktop/code/moodle/int/master/lib/tests/moodlelib_test.php:315 /home/andrew/Desktop/code/moodle/int/master/lib/phpunit/lib.php:1124 – There were 2 failures: 1) dml_testcase::test_unique_index_collation_trouble Unique index is accent insensitive, this may cause problems for non-ascii languages. This is usually caused by accent insensitive default collation. /home/andrew/Desktop/code/moodle/int/master/lib/dml/tests/dml_test.php:3428 2) dml_testcase::test_sql_binary_equal SQL operator "=" is expected to be case sensitive Failed asserting that 1 matches expected 2. /home/andrew/Desktop/code/moodle/int/master/lib/dml/tests/dml_test.php:3456 FAILURES! Tests: 1070, Assertions: 20551, Failures: 2, Errors: 1.
            Hide
            andyjdavis Andrew Davis added a comment -

            Stopping testing pending input from Andrew Nicols

            Show
            andyjdavis Andrew Davis added a comment - Stopping testing pending input from Andrew Nicols
            Hide
            andyjdavis Andrew Davis added a comment -

            After a discussion in chat with Andrew Nicols we've decided to pass this. It doesn't appear to have caused any regressions. It will be tested more thoroughly once MDL-32005 has been integrated as that issue contains a set of unit tests for this code.

            Show
            andyjdavis Andrew Davis added a comment - After a discussion in chat with Andrew Nicols we've decided to pass this. It doesn't appear to have caused any regressions. It will be tested more thoroughly once MDL-32005 has been integrated as that issue contains a set of unit tests for this code.
            Hide
            poltawski Dan Poltawski added a comment -

            Bonza mate!

            Your changes have made it into the Moodle release! Its time to celebrate! Put a shrimp on the barbie and grab a stubby.

            Hooroo

            Show
            poltawski Dan Poltawski added a comment - Bonza mate! Your changes have made it into the Moodle release! Its time to celebrate! Put a shrimp on the barbie and grab a stubby. Hooroo

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  25/Jun/12