Moodle
  1. Moodle
  2. MDL-27863

Fix testcase issues found in MDL-27577

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Deferred
    • Affects Version/s: 1.9.12, 2.0.3
    • Fix Version/s: 1.9.13, 2.0.4
    • Component/s: Libraries
    • Labels:
    • Environment:
      Mac and servers with different timezone then "Australia/Perth"
    • Testing Instructions:
      Hide

      1. Login as admin
      2. Update timezone (Site administration -> location -> update timezone)
      3. Run testmoodlelib.php simpletest.

      Instructions to run testmoodlelib.php simpletest
      On Moodle 2.xx
      1. Navigate to unit test (Development -> unit test)
      2. enter "lib/simpletest/testmoodlelib.php" in textbox.
      3. click "Run test"

      On Moodle 1.9x
      1. Navigate to unit test (Reports -> unit test)
      2. enter "lib/simpletest/testmoodlelib.php" in textbox.
      3. click "Run test"

      Show
      1. Login as admin 2. Update timezone (Site administration -> location -> update timezone) 3. Run testmoodlelib.php simpletest. Instructions to run testmoodlelib.php simpletest On Moodle 2.xx 1. Navigate to unit test (Development -> unit test) 2. enter "lib/simpletest/testmoodlelib.php" in textbox. 3. click "Run test" On Moodle 1.9x 1. Navigate to unit test (Reports -> unit test) 2. enter "lib/simpletest/testmoodlelib.php" in textbox. 3. click "Run test"
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Pull Master Branch:
      wip-mdl-27863-master

      Description

      Eloy found out few issues in testcase for MDL-27577.

      Issue 1:
      I'm passing the test because it seems that the offset is properly calculated always... but I'm getting this errors in my Mac:
      Expected: Friday, 1 July 2011, 10:00 AM => Actual: Friday, 1 July 2011, 10:00 am
      So really tests aren't passing here, because my local return the AM/PM information lowercased.

      Issue 2:
      Some of the tests are only going to work in sites being Perth/Australia @ OS, because test results are dependent of that.
      To be able to reproduce that, just add this line:
      date_default_timezone_set('Europe/Madrid');
      in the very fist lines of test_userdate() and you will get the offending ones.
      I think they are the ones calculating based on server time. I get 4 errors here.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Rajesh Taneja added a comment -

            Testcase failure in MDL-27577.

            Show
            Rajesh Taneja added a comment - Testcase failure in MDL-27577 .
            Hide
            Eloy Lafuente (stronk7) added a comment -

            master and 20_STABLE already integrated. Waiting for 19_STABLE to take rid of some PHP5-isms.

            Show
            Eloy Lafuente (stronk7) added a comment - master and 20_STABLE already integrated. Waiting for 19_STABLE to take rid of some PHP5-isms.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            19_STABLE fixes arrived so, integrated, thanks!

            Show
            Eloy Lafuente (stronk7) added a comment - 19_STABLE fixes arrived so, integrated, thanks!
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Passing tests. ALl seems to be working ok under 19 and 20.

            Show
            Eloy Lafuente (stronk7) added a comment - Passing tests. ALl seems to be working ok under 19 and 20.
            Hide
            Rajesh Taneja added a comment -

            Thanks Eloy

            Show
            Rajesh Taneja added a comment - Thanks Eloy
            Hide
            Michael de Raadt added a comment -

            Well, if it only affects Mac users, that's OK.

            Show
            Michael de Raadt added a comment - Well, if it only affects Mac users, that's OK.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            And now this has been spread to official git & cvs repos, thanks!

            Show
            Eloy Lafuente (stronk7) added a comment - And now this has been spread to official git & cvs repos, thanks!
            Hide
            Aaron Barnes added a comment -

            This is still broken in non-perth timezones in Moodle 1.9 (8 unit test failures, 4 after a timezone update).

            Show
            Aaron Barnes added a comment - This is still broken in non-perth timezones in Moodle 1.9 (8 unit test failures, 4 after a timezone update).
            Hide
            Rajesh Taneja added a comment -

            Thanks for reporting this Aaron,

            Testcase will fail for non-perth timezones because in 1.9 we are not setting default timezone to Australia/Perth

             
            date_default_timezone_set('Australia/Perth'); 
            

            This was done because date_default_timezone_set was introduces in PHP 5 >= 5.1.0. I can check with Eloy to see if we should bypass these tests for PHP < 5.1.0 or remove dependent test values

            Show
            Rajesh Taneja added a comment - Thanks for reporting this Aaron, Testcase will fail for non-perth timezones because in 1.9 we are not setting default timezone to Australia/Perth date_default_timezone_set('Australia/Perth'); This was done because date_default_timezone_set was introduces in PHP 5 >= 5.1.0. I can check with Eloy to see if we should bypass these tests for PHP < 5.1.0 or remove dependent test values
            Hide
            Eloy Lafuente (stronk7) added a comment - - edited

            For the sake of historic records... could we keep this closed and open a followup?

            I think the best for 19_STABLE is to keep only the tests that we know are going to work with any PHP version, aka, the ones not dependent of date_default_timezone_set('Australia/Perth'). So my +1 goes to delete the dependent assertions completely.

            Show
            Eloy Lafuente (stronk7) added a comment - - edited For the sake of historic records... could we keep this closed and open a followup? I think the best for 19_STABLE is to keep only the tests that we know are going to work with any PHP version, aka, the ones not dependent of date_default_timezone_set('Australia/Perth'). So my +1 goes to delete the dependent assertions completely.
            Hide
            Rajesh Taneja added a comment -

            This will be fixed by MDL-29001

            Show
            Rajesh Taneja added a comment - This will be fixed by MDL-29001

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: