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

Duplicate array key in various tests

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.2.9, 4.1.12, 4.3.6, 4.4.2
    • 3.9.24, 3.11.17, 4.2.8, 4.0.11, 4.1.6, 4.1.11, 4.2.3, 4.3.1, 4.3.5, 4.4.1, 4.5
    • Unit tests

      Following from MDL-79698 and including a duplicate array key sniff in our coding style, I have discovered the following unit test locations with duplicate array keys (mostly dataProvider definitions):

      ➜  sm git:(master) phpcs --sniffs=Universal.Arrays.DuplicateArrayKey `find . -path '*/tests/*_test.php'`
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/course/tests/externallib_test.php
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 2 ERRORS AFFECTING 2 LINES
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       3429 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "all limit and offset with wrong sort direction" was first seen on line 3419
       3489 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "all limit and offset with wrong field name" was first seen on line 3449
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/admin/tool/pluginskel/tests/atto_test.php
      ----------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      ----------------------------------------------------------------------------------------------------------------------------------
       51 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "settings" was first seen on line 50
      ----------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/enrol/tests/externallib_test.php
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       234 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Course with separate groups, filtering by withcapability (having moodle/role:review)" was first seen on line 217
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/enrol/lti/tests/local/ltiadvantage/entity/user_test.php
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 2 ERRORS AFFECTING 2 LINES
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------
       637 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Testing set_maildisplay with invalid int" was first seen on line 628
       662 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Testing set_lang with an empty string" was first seen on line 653
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/user/tests/table/participants_search_test.php
      ------------------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      ------------------------------------------------------------------------------------------------------------------------------------------------------------
       705 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "NONE: Filter on student, teacher" was first seen on line 693
      ------------------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/grade/report/history/tests/report_test.php
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 15 ERRORS AFFECTING 15 LINES
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       267 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email,lang and height,search for Spanish speakers" was first seen on line 265
       271 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email,lang and height,search for German speakers" was first seen on line 269
       275 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email,lang and height,search for English speakers" was first seen on line 273
       277 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email,lang and height,search for English speakers" was first seen on line 273
       281 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email,lang and height,search for users with height 180cm" was first seen on line 279
       285 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email,lang and height,search for users with height 170cm" was first seen on line 283
       297 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email and height,search for Spanish/German/English speakers" was first seen on line 295
       299 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email and height,search for Spanish/German/English speakers" was first seen on line 295
       301 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email,lang and height,search for English speakers" was first seen on line 273
       305 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email and height,search for English speakers" was first seen on line 303
       309 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email,lang and height,search for users with height 180cm" was first seen on line 279
       311 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email,lang and height,search for users with height 170cm" was first seen on line 283
       313 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email,lang and height,search for users with height 170cm" was first seen on line 283
       326 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email only;search for users with height 180cm" was first seen on line 325
       328 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "show email only;search for users with height 170cm" was first seen on line 327
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/question/type/numerical/tests/privacy/provider_test.php
      --------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      --------------------------------------------------------------------------------------------------------------------------------------------------
       116 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "unitsleft left example" was first seen on line 115
      --------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/question/type/ddmarker/tests/question_test.php
      ------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      ------------------------------------------------------------------------------------------------------------------------------
       245 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "c3" was first seen on line 245
      ------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/question/type/ddimageortext/tests/question_test.php
      ------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      ------------------------------------------------------------------------------------------------------------------------------
       227 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "p3" was first seen on line 227
      ------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/question/type/multichoice/tests/upgrade_old_attempt_data_test.php
      -----------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 4 ERRORS AFFECTING 4 LINES
      -----------------------------------------------------------------------------------------------------------------------------------------------
       64 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "questiondecimalpoints" was first seen on line 41
       65 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "showuserpicture" was first seen on line 42
       66 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "introformat" was first seen on line 40
       67 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "preferredbehaviour" was first seen on line 46
      -----------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/lib/tests/moodlelib_test.php
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 2 ERRORS AFFECTING 2 LINES
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        863 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "" was first seen on line 862
       3650 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Custom external confirmation url with parameters" was first seen on line 3645
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/lib/tests/component_test.php
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------
       767 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Getting a file with multiple namespaces" was first seen on line 760
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/filter/urltolink/tests/filter_test.php
      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       168 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "<input type="submit" value="Go to http://moodle.org">" was first seen on line 141
      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/filter/multilang/tests/filter_test.php
      -------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      -------------------------------------------------------------------------------------------------------------------------------------------------
       82 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Reversed input order EN" was first seen on line 77
      -------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/backup/moodle2/tests/moodle2_test.php
      --------------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      --------------------------------------------------------------------------------------------------------------------------------------
       1149 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "filepath" was first seen on line 1148
      --------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/mod/chat/tests/dates_test.php
      ----------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      ----------------------------------------------------------------------------------------------------------------------------------------------
       58 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "chattime in the past" was first seen on line 55
      ----------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/mod/feedback/tests/external/external_test.php
      --------------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 2 ERRORS AFFECTING 2 LINES
      --------------------------------------------------------------------------------------------------------------------------------------------------------
       479 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Closed feedback (as student)" was first seen on line 469
       504 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Closed feedback (as teacher)" was first seen on line 494
      --------------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/mod/h5pactivity/tests/xapi/handler_test.php
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 5 ERRORS AFFECTING 5 LINES
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------
       224 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Invalid verb and result" was first seen on line 221
       231 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Invalid result" was first seen on line 211
       243 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Invalid verb, result and context" was first seen on line 240
       262 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Invalid verb, result and user" was first seen on line 259
       280 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Invalid verb, result, context and user" was first seen on line 277
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/mod/h5pactivity/tests/lib_test.php
      ------------------------------------------------------------------------------------------------------------------------------------
      FOUND 2 ERRORS AFFECTING 2 LINES
      ------------------------------------------------------------------------------------------------------------------------------------
        82 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "filepath" was first seen on line 81
       376 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "filepath" was first seen on line 375
      ------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/mod/h5pactivity/tests/generator_test.php
      -------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      -------------------------------------------------------------------------------------------------------------------------------------------
       227 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "Other statement" was first seen on line 219
      -------------------------------------------------------------------------------------------------------------------------------------------
       
       
      FILE: /Users/nicols/Sites/moodles/sm/moodle/mod/lesson/tests/custom_completion_test.php
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AFFECTING 1 LINE
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       69 | ERROR | Duplicate array key found. The value will be overwritten. The string array key "User must reach end of lesson, has not met completion requirement" was first seen on line 66
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       
      Time: 38.59 secs; Memory: 164MB
      

            pholden Paul Holden
            dobedobedoh Andrew Lyons
            Andrew Lyons Andrew Lyons
            Simey Lameze Simey Lameze
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 5 minutes
                1h 5m

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