Moodle
  1. Moodle
  2. MDL-32926

$this->setUser(2); in unit tests is evil

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Unit tests
    • Labels:

      Description

      We really should have ->setAdminUser() and ->setNotLoggedInUser() methods, etc. Rather than using magic numbers.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Petr Skoda added a comment -

            Thanks, I agree the new methods would be better.

            Show
            Petr Skoda added a comment - Thanks, I agree the new methods would be better.
            Hide
            Petr Skoda added a comment -

            I have added setAdminUser() and setGuestUser(), the not-logged-in user is set via setUser(null/0).

            Show
            Petr Skoda added a comment - I have added setAdminUser() and setGuestUser(), the not-logged-in user is set via setUser(null/0).
            Hide
            Tim Hunt added a comment -

            +1 from me. Thanks for doing this Petr.

            Show
            Tim Hunt added a comment - +1 from me. Thanks for doing this Petr.
            Hide
            Dan Poltawski added a comment -

            integrated, thanks

            Show
            Dan Poltawski added a comment - integrated, thanks
            Hide
            Dan Poltawski added a comment -

            Time: 01:43, Memory: 247.50Mb

            OK (1183 tests, 21189 assertions)

            Show
            Dan Poltawski added a comment - Time: 01:43, Memory: 247.50Mb OK (1183 tests, 21189 assertions)
            Hide
            Eloy Lafuente (stronk7) added a comment -

            U P S T R E A M I Z E D !

            Many thanks for the hard work, closing this as fixed.

            Ciao

            Show
            Eloy Lafuente (stronk7) added a comment - U P S T R E A M I Z E D ! Many thanks for the hard work, closing this as fixed. Ciao

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: