aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/app/model/alert_type.t25
-rw-r--r--t/i18n.t13
2 files changed, 28 insertions, 10 deletions
diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t
index ac8013278..ae413978f 100644
--- a/t/app/model/alert_type.t
+++ b/t/app/model/alert_type.t
@@ -487,6 +487,31 @@ subtest "check local alerts from cobrand send main site url for alerts for diffe
like $body, qr#$expected2#, 'cobrand area report point to cobrand url';
};
+# Test that email alerts are sent in the right language.
+subtest "correct i18n-ed summary for state of closed" => sub {
+ $mech->clear_emails_ok;
+
+ $report->update( { state => 'closed' } );
+ $alert->update( { lang => 'nb', cobrand => 'fiksgatami' } );
+
+ FixMyStreet::App->model('DB::AlertSent')->search( {
+ alert_id => $alert->id,
+ parameter => $comment->id,
+ } )->delete;
+
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fiksgatami' ],
+ }, sub {
+ FixMyStreet::App->model('DB::AlertType')->email_alerts();
+ };
+
+ $mech->email_count_is( 1 );
+ my $email = $mech->get_email;
+ my $body = $email->body;
+ my $msg = 'Denne rapporten er for tiden markert som lukket';
+ like $body, qr/$msg/, 'email says problem is closed, in Norwegian';
+};
+
END {
$mech->delete_user($user) if $user;
$mech->delete_user($user2) if $user2;
diff --git a/t/i18n.t b/t/i18n.t
index f1cc86985..3337f1a7f 100644
--- a/t/i18n.t
+++ b/t/i18n.t
@@ -3,15 +3,12 @@ use warnings;
use Test::More;
-use FixMyStreet;
-use mySociety::Locale;
-use Encode;
-use Data::Dumper;
use HTTP::Headers;
use Sort::Key qw(keysort);
use POSIX 'strcoll';
-local $Data::Dumper::Sortkeys = 1;
-use utf8;
+
+use FixMyStreet;
+use mySociety::Locale;
# check that the mo files have been generated
die "You need to run 'commonlib/bin/gettext-makemo --quiet FixMyStreet' "
@@ -59,10 +56,6 @@ my @EN_sorted = qw( A Å Ø Z );
my @NO_sorted = qw( A Z Ø Å );
my @default_sorted = qw( A Z Å Ø );
-sub utf8_diag {
- diag encode_utf8( Dumper(@_) );
-}
-
{
mySociety::Locale::negotiate_language( #