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

Refactor quizaccess_seb unit tests

    XMLWordPrintable

    Details

      Description

      Some issues with unit tests in quizaccess_seb were identified as part of  MDL-68654

      https://tracker.moodle.org/browse/MDL-68654?focusedCommentId=796785&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-796785

      1) Forcing $this->resetAfterTest() and generator->create_course() in quizaccess_seb_testcase->setUp(). That code should be the nearest possible to the unit test. Right now, every unit test that we want to write will force, always, a database reset and the creation of a course, when we may be, perfectly, covering some method not requiring any of them.

      2) Creating a parent quizaccess_seb_testcase itself, without any unit test (test_xxx) method... is prone to errors. If tomorrow anybody wants to create a unit test and adds it to that class... those tests will be executed X times, child classes will run it again and again. That should be a helper/fixtures or anything else, not a testcase.

      3) BTW, also, we discovered yesterday... that the path for all those tests are really wrong (tests/phpunit). "phpunit" is not valid at all. Not sure if this has been reported in another issue, I just remember it because yesterday we were all surprised that we missed that detail.

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dmitriim Dmitrii Metelkin
              Reporter:
              dmitriim Dmitrii Metelkin
              Peer reviewer:
              Tim Hunt Tim Hunt
              Integrator:
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Tester:
              CiBoT CiBoT
              Participants:
              Component watchers:
              Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Jun/20

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 51 minutes
                  51m