MDL-65204 phpunit: various fixes to assertions
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 27 Mar 2019 12:05:35 +0000 (13:05 +0100)
committerJun Pataleta <jun@moodle.com>
Wed, 3 Apr 2019 02:39:19 +0000 (10:39 +0800)
commit85f47bae7f3e7ded3bce20396b166ff97d500219
treec28afd11282c83e7f9905c73c27d1e1b07c61d47
parent26218b7852802525de1686680fab1514850b824a
MDL-65204 phpunit: various fixes to assertions

 Namely:
   - 3rd param of assertEquals() cannot be null.
   - Some incorrect uses of assertNotEmpty().
   - Comparing 2 strings now uses strict (===) evaluation.
Link: https://github.com/sebastianbergmann/phpunit/issues/3185
     Solution here is one of:
       a) Return to the previous situation, making the comparison
          softer. That can achieved by forcing different types, so
          float == string works.
       b) Changing APIs (both forms and database return strings) to
          perform some conversion to floats. That would make float
          comparison (with floats or strings) to work too.
     The patch here follows the a) approach. Changing all the internals
     for proper float handling sounds excesive when it has been working
     perfectly since ever. So we went the easier route, just getting
     rid of the new === comparisons when needed by changing expectation
     types to float.
admin/tool/dataprivacy/tests/metadata_registry_test.php
admin/tool/log/tests/privacy_test.php
mod/assign/tests/events_test.php
mod/assign/tests/externallib_test.php
mod/assign/tests/locallib_test.php
mod/assign/tests/privacy_test.php
mod/quiz/tests/attempt_walkthrough_from_csv_test.php
mod/workshop/tests/privacy_provider_test.php
question/type/multichoice/tests/helper.php
question/type/multichoice/tests/upgradelibnewqe_test.php