[Rt-commit] rt branch, 4.0/make-date-tests-locale-independent, updated. rt-4.0.1rc1-6-g0f3d6b4

Alex Vandiver alexmv at bestpractical.com
Thu Dec 29 20:37:38 EST 2011


The branch, 4.0/make-date-tests-locale-independent has been updated
       via  0f3d6b4afa982f35ca444c6417b8223c92a87096 (commit)
      from  ea553805004e2fe114778029939aaf2d2c4670d5 (commit)

Summary of changes:
 lib/RT/Test.pm |    3 +++
 t/api/date.t   |    2 --
 2 files changed, 3 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 0f3d6b4afa982f35ca444c6417b8223c92a87096
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Dec 29 19:52:40 2011 -0500

    Ensure that I18N::LangTags::Detect only finds the "C" locale in tests
    
    The I18N::LangTags::Detect package, which RT uses to auto-detect the
    user's language preference in the browser, also looks at several
    environment variables which are more commonly set on the command line.
    This is only an issue during tests, as we expect the language to always
    be English.
    
    Explicitly always remove all of the environment variables which
    I18N::LangTags::Detect looks at, and set LANG=C to provide a reference
    point.

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index b468aae..27af608 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -112,6 +112,9 @@ sub generate_port {
 BEGIN {
     $port   = generate_port();
     $dbname = $ENV{RT_TEST_PARALLEL}? "rt4test_$port" : "rt4test";
+
+    delete $ENV{$_} for qw/LANGUAGE LC_ALL LC_MESSAGES LANG/;
+    $ENV{LANG} = "C";
 };
 
 sub import {
diff --git a/t/api/date.t b/t/api/date.t
index bd8602a..9756e51 100644
--- a/t/api/date.t
+++ b/t/api/date.t
@@ -1,7 +1,5 @@
 #!/usr/bin/perl
 
-BEGIN { $ENV{'LANG'} = 'C'; $ENV{'LC_ALL'} = ''; }
-
 use Test::MockTime qw(set_fixed_time restore_time);
 use DateTime;
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list