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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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

          Attachments

            Issue Links

              Activity

              Hide
              skodak Petr Skoda added a comment -

              Thanks, I agree the new methods would be better.

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

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

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

              +1 from me. Thanks for doing this Petr.

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

              integrated, thanks

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

              Time: 01:43, Memory: 247.50Mb

              OK (1183 tests, 21189 assertions)

              Show
              poltawski Dan Poltawski added a comment - Time: 01:43, Memory: 247.50Mb OK (1183 tests, 21189 assertions)
              Hide
              stronk7 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
              stronk7 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:
                    Fix Release Date:
                    25/Jun/12