1. 31 Mar, 2021 1 commit
  2. 12 Mar, 2021 3 commits
    • Eloy Lafuente's avatar
      MDL-71036 phpunit: Coding style changes, 99% whitespace only · 713722c3
      Eloy Lafuente authored
      I've gone over a few of the mofified files (those
      which were showing warnings and errors to CiBoT. Some of them
      have been fixed completely, while others only have fixed
      for the lines belonging to this issue (lib/tests/moodlelib_test.php)
      for example.
      713722c3
    • Eloy Lafuente's avatar
      MDL-71036 phpunit: assertContains() now performs strict comparison · 8a14a7bd
      Eloy Lafuente authored
      The methods assertContains() and assertNotContains() now perform
      strict (type and value) comparison, pretty much like assertSame()
      does.
      
      A couple of new assertContainsEquals() and assertNotContainsEquals()
      methods have been created to provide old (non-strict) behavior, pretty
      much like assertEquals() do.
      
      Apart from replacing the calls needing a relaxed comparison to those
      new methods, there are also a couple of alternative, about how to
      fix this, depending of every case:
      
      - If the test is making any array_values() conversion, then it's better
        to remove that conversion and use assertArrayHasKey(), that is not
        strict.
      - Sometimes if may be also possible to, simply, cast the expectation
        to the exact type coming in the array. I've not applied this technique
        to any of the cases in core.
      
      Link: https://github.com/sebastianbergmann/phpunit/issues/3426
      8a14a7bd
    • Eloy Lafuente's avatar
      MDL-71036 phpunit: Renamed various regexp-related assertions · ba5b6089
      Eloy Lafuente authored
      In PHPUnit 9.1, the following regexp-related assertions
      have been deprecated and there are new alternatives for
      all them:
          - assertRegExp()     -> assertMatchesRegularExpression()
          - assertNotRegExp()  -> assertDoesNotMatchRegularExpression()
      
      This is about to, simply, move all cases to the new alternatives.
      
      Source: https://github.com/sebastianbergmann/phpunit/blob/9.1.0/ChangeLog-9.1.md
      
      Regexp to find all them:
      
          ag 'assertRegExp|assertNotRegExp' -li
      ba5b6089
  3. 05 Mar, 2021 1 commit
  4. 01 Mar, 2021 1 commit
  5. 17 Feb, 2021 1 commit
  6. 09 Feb, 2021 1 commit
  7. 05 Feb, 2021 1 commit
  8. 03 Feb, 2021 1 commit
  9. 02 Feb, 2021 1 commit
    • jun's avatar
      MDL-70288 qtype: Remove unnecessary empty label string · 2961feb7
      jun authored
      * When a label is passed to an (advanced) checkbox and no text
        was provided, the label will be displayed on the right of the the
        checkbox element. So there's no point in passing an empty string for
        the label just to render the text to the right of the checkbox.
      2961feb7
  10. 22 Jan, 2021 1 commit
    • Andrew Nicols's avatar
      MDL-66979 question: Improve behat test reliability · cedb58f6
      Andrew Nicols authored
      Expand all fieldsets rather than individual fieldsets.
      
      This can fail in some situations where the page moves as the first
      fieldset opens and HTML transitions take effect. This causes subsequent
      fieldsets to move after WebDriver has calculated the click target.
      cedb58f6
  11. 18 Jan, 2021 1 commit
  12. 14 Jan, 2021 1 commit
    • Eloy Lafuente's avatar
      MDL-69308 upgrade: remove all the < 3.6.0 upgrade steps · 77342b96
      Eloy Lafuente authored
      This just deletes all the upgrade steps previous to 3.6.0. Some
      small adjustments, like tweaking globals can also be applied
      when needed.
      
      Also includes an upgrade step to prevent upgrading from any
      version < 2018120300 (v3.6.0) as anti-cheating measure.
      
      Note that in this case, there wasn't any case of upgradelib
      functions being used, hence we haven't to deprecate/remove
      anything in codebase. When there is such a need, that is done
      in separate commits (one for each function) and documented here.
      
      See MDL-65809 commits for an example removing/deprecating a
      good number of functions.
      77342b96
  13. 13 Jan, 2021 4 commits
  14. 12 Jan, 2021 1 commit
  15. 18 Dec, 2020 2 commits
  16. 09 Dec, 2020 1 commit
  17. 03 Dec, 2020 1 commit
  18. 26 Nov, 2020 1 commit
  19. 18 Nov, 2020 2 commits
  20. 17 Nov, 2020 1 commit
  21. 16 Nov, 2020 1 commit
  22. 11 Nov, 2020 2 commits
  23. 04 Nov, 2020 2 commits
  24. 29 Oct, 2020 2 commits
    • jun's avatar
      MDL-70032 qtype_multichoice: Use custom partial named selector · ac9ecf6b
      jun authored
      * With the removal of the label element, Behat now has to click on the
      answer text. In order to achieve this, the custom partial named selector
      "qtype_multichoice > Answer" was now added and have replaced the
      instances where the label of the answer's checkbox/radio button is
      being clicked.
      ac9ecf6b
    • jun's avatar
      MDL-70032 qtype_multichoice: Fix answer labelling · a1d81dc6
      jun authored
      * Discard the use of the label element in order to be able to render
      multiple choice answers as they are and have these act as the radio
      button/checkbox' label through the aria-labelledby attribute.
      * New JS module qtype_multichoice/answers that listens for click events
      on the answer text container and selects the appropriate answer radio
      button/checkbox.
      a1d81dc6
  25. 27 Oct, 2020 1 commit
  26. 25 Oct, 2020 1 commit
  27. 21 Oct, 2020 4 commits
    • Eloy Lafuente's avatar
      MDL-67673 phpunit: Remove deprecated assertEquals() params · 3a5641cb
      Eloy Lafuente authored
      The optional parameters of assertEquals() and assertNotEquals()
      are deprecated in PHPUnit 8 (to be removed in PHPUnit 9):
      
      - delta => use assertEqualsWithDelta()
      - canonicalize => use assertEqualsCanonicalizing()
      - ignoreCase => use assertEqualsIgnoringCase
      - maxDepth => removed without replacement.
      
      More info @ https://github.com/sebastianbergmann/phpunit/issues/3341
      
      Initial search done with:
      
      ag 'assert(Not)?Equals\(.*,.*,' --php
      
      Then, running tests and fixing remaining cases.
      3a5641cb
    • Eloy Lafuente's avatar
      MDL-67673 phpunit: Remove deprecated assertContains() uses on strings · 40de097e
      Eloy Lafuente authored
      Both assertContains() and assertNotContains() are deprecated in PHPUnit 8
      for operations on strings. Also the optional case parameter is. All uses
      must be changed to one of:
      
      - assertStringContainsString()
      - assertStringContainsStringIgnoringCase()
      - assertStringNotContainsString()
      - assertStringNotContainsStringIgnoringCase()
      
      More info: https://github.com/sebastianbergmann/phpunit/issues/3422
      
      Regexp to find all uses:
      
      ag 'assert(Not)?Contains\('
      40de097e
    • Eloy Lafuente's avatar
      MDL-67673 phpunit: Remove deprecated non-public attribute assertions · a293b3ae
      Eloy Lafuente authored
      With PHPUnit 8 a good number of assertions, all them related with
      operations on non-public attributes have been deprecated. And will
      be removed with PHPUnit 9.
      
      The main point is that unit tests shouldn't be testing non-public
      APIs (good practice) and those assertions were an error originally.
      
      See https://github.com/sebastianbergmann/phpunit/issues/3338 for
      the complete list and other details.
      
      When possible (the attributes being checked are public), the change
      is simple, just switching to normal assertions.
      
      When the attributes are not public we need to find a workaround
      to be able to test the same using public APIs, or use Reflection,
      or remove the tests.
      
      For the records, this is the regexp used to find all the cases:
      
      ag '>(assertAttribute|attribute\(|readAttributte|getStaticAttribute| \
          getObjectAttribute)' -G "test.php"
      a293b3ae
    • Eloy Lafuente's avatar
      MDL-67673 phpunit: Remove expectedException annotations · d95c3787
      Eloy Lafuente authored
      While this is not strictly required, because removal will
      happen in PHPUnit 9.0, we are already getting rid of all
      uses in core.
      
      From release notes:https://phpunit.de/announcements/phpunit-8.html
      
      The annotations `@expectedException`, `@expectedExceptionCode`,
      `@expectedExceptionMessage`, and `@expectedExceptionMessageRegExp`
      are now deprecated.
      Using these annotations will trigger a deprecation warning
      in PHPUnit 8 and in PHPUnit 9 these annotations will be removed.
      
      Also, all uses of expectExceptionMessageRegExp() has been moved
      to expectExceptionMessageMatches(). See https://github.com/sebastianbergmann/phpunit/issues/3957
      
      TODO: Various weirdness found while doing the changes with these tests:
      - vendor/bin/phpunit lib/tests/exporter_test.php (created MDL-69700)
      - vendor/bin/phpunit competency/tests/external_test.php (same issue than prev one)
      - vendor/bin/phpunit question/engine/tests/questionengine_test.php (created MDL-69624)
      - vendor/bin/phpunit lib/tests/event_test.php (created MDL-69688)
      d95c3787