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

Provide better error when missing en_AU.UTF-8 locale in phpunit

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Prerequisites:
      You need an install without the en_AU.UTF-8 locale. I found this slightly tricky to do - ubuntu installs all the english variants by default and hard to get rid of it. So did it with a debian stable expert install, ensuring that I did not select the en_AU locale, only en_GB. If you've already got a debian stable install you can probably get rid of it by doing sudo dpkg-reconfigure locales and unselected en_au.
      You can check installed locales with locale -a

      Testing instuctions

      1. Run php admin/tool/phpunit/cli/init.php and vendor/bin/phpunit core_phpunit_advanced_testcase lib/phpunit/tests/advanced_test.php
      2. VERIFY both fails with:

        Moodle PHPUnit environment configuration error:
        Required locale 'en_AU.UTF-8' is not installed.
        

      3. sudo dpkg-reconfigure locales and select the 'en_AU.UTF-8' locale
      4. Verify phpunit runs as normal
      5. Regression test: run phpunit on windows and ensure it passes
      Show
      Prerequisites: You need an install without the en_AU.UTF-8 locale. I found this slightly tricky to do - ubuntu installs all the english variants by default and hard to get rid of it. So did it with a debian stable expert install, ensuring that I did not select the en_AU locale, only en_GB. If you've already got a debian stable install you can probably get rid of it by doing sudo dpkg-reconfigure locales and unselected en_au. You can check installed locales with locale -a Testing instuctions Run php admin/tool/phpunit/cli/init.php and vendor/bin/phpunit core_phpunit_advanced_testcase lib/phpunit/tests/advanced_test.php VERIFY both fails with: Moodle PHPUnit environment configuration error: Required locale 'en_AU.UTF-8' is not installed. sudo dpkg-reconfigure locales and select the 'en_AU.UTF-8' locale Verify phpunit runs as normal Regression test: run phpunit on windows and ensure it passes
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-50687-master

      Description

      MDL-49684 revamped timezone support (yay). According to the commit message "phpunit has Australia/Perth as default timezone." I don't think this is working. Starting with 2.9 I'm getting 1800+ warnings like this one:

      1) qtype_numerical_attempt_upgrader_test::test_numerical_deferredfeedback_history620
      Warning: unexpected change of locale

      /var/www/moodle/htdocs/lib/phpunit/classes/util.php:272
      /var/www/moodle/htdocs/lib/phpunit/classes/advanced_testcase.php:125

      To re-run:
      vendor/bin/phpunit qtype_numerical_attempt_upgrader_test question/type/numerical/tests/upgradelibnewqe_test.php

      I'm seeing this in instances where Moodle and PHPUnit have been installed from the command line. The locale on these systems is en_US.UTF-8.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                21/Dec/15