diff options
Diffstat (limited to 't')
-rw-r--r-- | t/app/01app.t | 7 | ||||
-rw-r--r-- | t/app/controller/about.t | 8 | ||||
-rw-r--r-- | t/app/model/alert_type.t | 8 | ||||
-rw-r--r-- | t/app/model/state.t | 8 | ||||
-rw-r--r-- | t/i18n.t | 32 | ||||
-rw-r--r-- | t/open311/getupdates.t | 9 |
6 files changed, 33 insertions, 39 deletions
diff --git a/t/app/01app.t b/t/app/01app.t index df562b829..596e0de47 100644 --- a/t/app/01app.t +++ b/t/app/01app.t @@ -4,7 +4,7 @@ use strict; use warnings; package FixMyStreet::Cobrand::Tester; -use parent 'FixMyStreet::Cobrand::FiksGataMi'; +use parent 'FixMyStreet::Cobrand::FixaMinGata'; sub front_stats_data { { new => 0, fixed => 0, updates => 12345 } } package main; @@ -12,7 +12,6 @@ package main; use Test::More; use Catalyst::Test 'FixMyStreet::App'; use charnames ':full'; -use Encode qw(encode); ok( request('/')->is_success, 'Request should succeed' ); @@ -20,10 +19,8 @@ SKIP: { FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'tester' ], }, sub { - skip 'Test will not pass on Mac OS', 1 if $^O eq 'darwin'; - my $page = get('/'); - my $num = encode('UTF-8', "12\N{NO-BREAK SPACE}345"); + my $num = "12 345"; like $page, qr/$num/; }; } diff --git a/t/app/controller/about.t b/t/app/controller/about.t index 43ee642e4..e1ffc34bb 100644 --- a/t/app/controller/about.t +++ b/t/app/controller/about.t @@ -24,12 +24,12 @@ ok !$mech->res->is_success(), "want a bad response"; is $mech->res->code, 404, "got 404"; FixMyStreet::override_config { - ALLOWED_COBRANDS => [ 'fiksgatami' ], + ALLOWED_COBRANDS => [ 'fixamingata' ], }, sub { - ok $mech->host("www.fiksgatami.no"), 'host to fiksgatami'; + ok $mech->host("www.fixamingata.se"), 'host to fixamingata'; $mech->get_ok('/faq'); - $mech->content_like(qr{Ofte spurte spørsmål ::}); - $mech->content_contains('html class="no-js" lang="nb"'); + $mech->content_like(qr{Vanliga frågor ::}); + $mech->content_contains('html class="no-js" lang="sv"'); }; $mech->get_ok('/'); diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t index 78574ac36..ecca2df3d 100644 --- a/t/app/model/alert_type.t +++ b/t/app/model/alert_type.t @@ -486,7 +486,7 @@ subtest "correct i18n-ed summary for state of closed" => sub { $mech->clear_emails_ok; $report->update( { state => 'closed' } ); - $alert->update( { lang => 'nb', cobrand => 'fiksgatami' } ); + $alert->update( { lang => 'sv', cobrand => 'fixamingata' } ); FixMyStreet::DB->resultset('AlertSent')->search( { alert_id => $alert->id, @@ -494,14 +494,14 @@ subtest "correct i18n-ed summary for state of closed" => sub { } )->delete; FixMyStreet::override_config { - ALLOWED_COBRANDS => [ 'fiksgatami' ], + ALLOWED_COBRANDS => [ 'fixamingata' ], }, sub { FixMyStreet::DB->resultset('AlertType')->email_alerts(); }; my $body = $mech->get_text_body_from_email; - my $msg = 'Denne rapporten er for tiden markert som lukket'; - like $body, qr/$msg/, 'email says problem is closed, in Norwegian'; + my $msg = 'Den här rapporten är markerad som stängd'; + like $body, qr/$msg/, 'email says problem is closed, in Swedish'; }; END { diff --git a/t/app/model/state.t b/t/app/model/state.t index 35f3d4fb3..f680cf3e8 100644 --- a/t/app/model/state.t +++ b/t/app/model/state.t @@ -66,14 +66,14 @@ is_deeply [ sort FixMyStreet::DB::Result::Problem->fixed_states ], ['fixed', 'fixed - council', 'fixed - user'], 'fixed states okay'; FixMyStreet::override_config { - LANGUAGES => [ 'en-gb,English,en_GB', 'nb,Norwegian,nb_NO' ], + LANGUAGES => [ 'en-gb,English,en_GB', 'sv,Swedish,sv_SE' ], }, sub { subtest 'translation of open works both ways (file/db)' => sub { # Note at this point the states have been cached my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('default')->new; - my $lang = $cobrand->set_lang_and_domain('nb', 1, FixMyStreet->path_to('locale')->stringify); - is $lang, 'nb'; - is $rs->display('confirmed'), "Åpen"; + my $lang = $cobrand->set_lang_and_domain('sv', 1, FixMyStreet->path_to('locale')->stringify); + is $lang, 'sv'; + is $rs->display('confirmed'), "Öppen"; $lang = $cobrand->set_lang_and_domain('en-gb', 1, FixMyStreet->path_to('locale')->stringify); is $lang, 'en-gb'; is $rs->display('confirmed'), "Open Eng trans"; @@ -15,7 +15,7 @@ use mySociety::Locale; die "You need to run 'commonlib/bin/gettext-makemo --quiet FixMyStreet' " . "to generate the *.mo files needed." unless -e FixMyStreet->path_to( - 'locale/nb_NO.UTF-8/LC_MESSAGES/FixMyStreet.mo'); + 'locale/sv_SE.UTF-8/LC_MESSAGES/FixMyStreet.mo'); # Test the language negotiation works my $lang = mySociety::Locale::negotiate_language( @@ -29,32 +29,32 @@ is $lang, 'es', 'Language negotiation works okay'; # Example strings my $english = "Please enter a valid email"; -my $norwegian = "Legg til en gyldig e-post"; +my $swedish = "Skriv in en giltig epostadress"; # set english as the language mySociety::Locale::negotiate_language( # - 'en-gb,English,en_GB|nb,Norwegian,nb_NO', 'en_GB' + 'en-gb,English,en_GB|sv,Swedish,sv_SE', 'en_GB' ); mySociety::Locale::gettext_domain( 'FixMyStreet', 1 ); mySociety::Locale::change(); is _($english), $english, "english to english"; -mySociety::Locale::change('nb'); -is _($english), $norwegian, "english to norwegian"; +mySociety::Locale::change('sv'); +is _($english), $swedish, "english to Swedish"; # check that being in a deep directory does not confuse the code chdir FixMyStreet->path_to('t/app/controller') . ''; mySociety::Locale::gettext_domain( 'FixMyStreet', 1, FixMyStreet->path_to('locale')->stringify ); -mySociety::Locale::change('nb'); -is _($english), $norwegian, "english to norwegian (deep directory)"; +mySociety::Locale::change('sv'); +is _($english), $swedish, "english to Swedish (deep directory)"; # test that sorting works as expected in the right circumstances... -my @random_sorted = qw( Å Z Ø A ); -my @EN_sorted = qw( A Å Ø Z ); -my @NO_sorted = qw( A Z Ø Å ); -my @default_sorted = qw( A Z Å Ø ); +my @random_sorted = qw( Å Z Ö A ); +my @EN_sorted = qw( A Å Ö Z ); +my @SV_sorted = qw( A Z Å Ö ); +my @default_sorted = qw( A Z Å Ö ); SKIP: { @@ -98,22 +98,20 @@ SKIP: { } SKIP: { - skip 'Will not pass on Mac', 2 if $^O eq 'darwin'; - mySociety::Locale::negotiate_language( # - 'nb-no,Norwegian,nb_NO', 'nb_NO' + 'sv,Swedish,sv_SE', 'sv_SE' ); mySociety::Locale::change(); use locale; is_deeply( [ sort @random_sorted ], - \@NO_sorted, "sort correctly with use locale 'nb_NO'" ); + \@SV_sorted, "sort correctly with use locale 'sv_SE'" ); # is_deeply( [ keysort { $_ } @random_sorted ], - # \@NO_sorted, "keysort correctly with use locale 'nb_NO'" ); + # \@SV_sorted, "keysort correctly with use locale 'sv_SE'" ); is_deeply( [ sort { strcoll( $a, $b ) } @random_sorted ], - \@NO_sorted, "sort strcoll correctly with use locale 'nb_NO'" ); + \@SV_sorted, "sort strcoll correctly with use locale 'sv_SE'" ); } subtest "check that code is only called once by in_gb_locale" => sub { diff --git a/t/open311/getupdates.t b/t/open311/getupdates.t index 1cbabc5ab..351f17f6f 100644 --- a/t/open311/getupdates.t +++ b/t/open311/getupdates.t @@ -1,5 +1,4 @@ -#!/usr/bin/env perl - +use utf8; use FixMyStreet::Test; use URI::Split qw(uri_split); @@ -220,7 +219,7 @@ my $problem3 = $problem_rs->create( { used_map => 1, name => '', state => 'confirmed', - cobrand => 'fiksgatami', + cobrand => 'fixamingata', user => $user, created => DateTime->now()->subtract( days => 1 ), lastupdate => DateTime->now()->subtract( days => 1 ), @@ -235,7 +234,7 @@ subtest 'test translation of auto-added comment from old-style Open311 update' = my $o = Open311->new( jurisdiction => 'mysociety', endpoint => 'http://example.com', test_mode => 1, test_get_returns => { 'requests.xml' => $requests_xml } ); FixMyStreet::override_config { - ALLOWED_COBRANDS => [ 'fiksgatami' ], + ALLOWED_COBRANDS => [ 'fixamingata' ], }, sub { ok $updates->update_reports( [ 638346 ], $o, $body ), 'Updated reports'; }; @@ -245,7 +244,7 @@ subtest 'test translation of auto-added comment from old-style Open311 update' = is_deeply(\@qs, [ 'jurisdiction_id=mysociety', 'service_request_id=638346' ], 'query string matches'); is $problem3->comments->count, 1, 'added a comment'; - is $problem3->comments->first->text, "(ikke rapportert til administrasjonen)", 'correct comment text'; + is $problem3->comments->first->text, "Stängd av kommunen", 'correct comment text'; }; END { |