diff options
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/about.t | 1 | ||||
-rw-r--r-- | t/app/controller/admin.t | 18 | ||||
-rw-r--r-- | t/app/controller/admin/update_edit.t | 16 | ||||
-rw-r--r-- | t/app/controller/around.t | 2 | ||||
-rw-r--r-- | t/app/controller/moderate.t | 4 | ||||
-rw-r--r-- | t/app/controller/report_new.t | 2 | ||||
-rw-r--r-- | t/app/controller/rss.t | 3 | ||||
-rw-r--r-- | t/app/controller/token.t | 4 | ||||
-rw-r--r-- | t/app/helpers/send_email.t | 2 | ||||
-rw-r--r-- | t/app/model/alert_type.t | 3 | ||||
-rw-r--r-- | t/cobrand/bucks.t | 4 | ||||
-rw-r--r-- | t/cobrand/fixmystreet.t | 5 | ||||
-rw-r--r-- | t/cobrand/restriction.t | 5 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 2 | ||||
-rw-r--r-- | t/cobrand/zurich_attachments.txt | 2 |
15 files changed, 38 insertions, 35 deletions
diff --git a/t/app/controller/about.t b/t/app/controller/about.t index 04d902bc5..43ee642e4 100644 --- a/t/app/controller/about.t +++ b/t/app/controller/about.t @@ -4,6 +4,7 @@ sub path_to_web_templates { [ FixMyStreet->path_to( 't', 'app', 'controller', 't package main; +use utf8; use FixMyStreet::TestMech; ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' ); diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index d50702086..b170633fc 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -25,7 +25,7 @@ my $dt = DateTime->new( second => 23 ); -my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( +my $report = FixMyStreet::DB->resultset('Problem')->find_or_create( { postcode => 'SW1A 1AA', bodies_str => '2504', @@ -53,7 +53,7 @@ my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( my $report_id = $report->id; ok $report, "created test report - $report_id"; -my $alert = FixMyStreet::App->model('DB::Alert')->find_or_create( +my $alert = FixMyStreet::DB->resultset('Alert')->find_or_create( { alert_type => 'area_problems', parameter => 2482, @@ -65,20 +65,20 @@ my $alert = FixMyStreet::App->model('DB::Alert')->find_or_create( $mech->log_in_ok( $superuser->email ); subtest 'check summary counts' => sub { - my $problems = FixMyStreet::App->model('DB::Problem')->search( { state => { -in => [qw/confirmed fixed closed investigating planned/, 'in progress', 'fixed - user', 'fixed - council'] } } ); + my $problems = FixMyStreet::DB->resultset('Problem')->search( { state => { -in => [qw/confirmed fixed closed investigating planned/, 'in progress', 'fixed - user', 'fixed - council'] } } ); ok $mech->host('www.fixmystreet.com'); my $problem_count = $problems->count; $problems->update( { cobrand => '' } ); - FixMyStreet::App->model('DB::Problem')->search( { bodies_str => 2489 } )->update( { bodies_str => 1 } ); + FixMyStreet::DB->resultset('Problem')->search( { bodies_str => 2489 } )->update( { bodies_str => 1 } ); - my $q = FixMyStreet::App->model('DB::Questionnaire')->find_or_new( { problem => $report, }); + my $q = FixMyStreet::DB->resultset('Questionnaire')->find_or_new( { problem => $report, }); $q->whensent( \'current_timestamp' ); $q->in_storage ? $q->update : $q->insert; - my $alerts = FixMyStreet::App->model('DB::Alert')->search( { confirmed => { '>' => 0 } } ); + my $alerts = FixMyStreet::DB->resultset('Alert')->search( { confirmed => { '>' => 0 } } ); my $a_count = $alerts->count; FixMyStreet::override_config { @@ -92,7 +92,7 @@ subtest 'check summary counts' => sub { $mech->content_contains( "$problem_count</strong> live problems" ); $mech->content_contains( "$a_count confirmed alerts" ); - my $questionnaires = FixMyStreet::App->model('DB::Questionnaire')->search( { whensent => { -not => undef } } ); + my $questionnaires = FixMyStreet::DB->resultset('Questionnaire')->search( { whensent => { -not => undef } } ); my $q_count = $questionnaires->count(); $mech->content_contains( "$q_count questionnaires sent" ); @@ -130,12 +130,12 @@ subtest 'check summary counts' => sub { $alert->update; }; - FixMyStreet::App->model('DB::Problem')->search( { bodies_str => 1 } )->update( { bodies_str => 2489 } ); + FixMyStreet::DB->resultset('Problem')->search( { bodies_str => 1 } )->update( { bodies_str => 2489 } ); ok $mech->host('www.fixmystreet.com'); }; subtest "Check admin_base_url" => sub { - my $rs = FixMyStreet::App->model('DB::Problem'); + my $rs = FixMyStreet::DB->resultset('Problem'); my $cobrand = $report->get_cobrand_logged; is ($report->admin_url($cobrand), diff --git a/t/app/controller/admin/update_edit.t b/t/app/controller/admin/update_edit.t index 6ddbdbdfc..cf371651b 100644 --- a/t/app/controller/admin/update_edit.t +++ b/t/app/controller/admin/update_edit.t @@ -10,7 +10,7 @@ my $user2 = $mech->create_user_ok('test2@example.com', name => 'Test User 2'); my $superuser = $mech->create_user_ok('superuser@example.com', name => 'Super User', is_superuser => 1); -my $user3 = FixMyStreet::App->model('DB::User')->create( { email => 'test3@example.com' } ); +my $user3 = FixMyStreet::DB->resultset('User')->create( { email => 'test3@example.com' } ); my $dt = DateTime->new( year => 2011, @@ -21,7 +21,7 @@ my $dt = DateTime->new( second => 23 ); -my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( +my $report = FixMyStreet::DB->resultset('Problem')->find_or_create( { postcode => 'SW1A 1AA', bodies_str => '2504', @@ -52,7 +52,7 @@ $mech->log_in_ok( $superuser->email ); my $report_id = $report->id; ok $report, "created test report - $report_id"; -my $update = FixMyStreet::App->model('DB::Comment')->create( +my $update = FixMyStreet::DB->resultset('Comment')->create( { text => 'this is an update', user => $user, @@ -63,7 +63,7 @@ my $update = FixMyStreet::App->model('DB::Comment')->create( } ); -my $log_entries = FixMyStreet::App->model('DB::AdminLog')->search( +my $log_entries = FixMyStreet::DB->resultset('AdminLog')->search( { object_type => 'update', object_id => $update->id @@ -275,7 +275,7 @@ for my $test ( } subtest 'editing update email creates new user if required' => sub { - my $user = FixMyStreet::App->model('DB::User')->find( { email => 'test4@example.com' } ); + my $user = FixMyStreet::DB->resultset('User')->find( { email => 'test4@example.com' } ); $user->delete if $user; @@ -289,7 +289,7 @@ subtest 'editing update email creates new user if required' => sub { $mech->submit_form_ok( { with_fields => $fields } ); - $user = FixMyStreet::App->model('DB::User')->find( { email => 'test4@example.com' } ); + $user = FixMyStreet::DB->resultset('User')->find( { email => 'test4@example.com' } ); is_deeply $mech->visible_form_values, $fields, 'submitted form values'; @@ -302,7 +302,7 @@ subtest 'editing update email creates new user if required' => sub { subtest 'adding email to abuse list from update page' => sub { my $email = $update->user->email; - my $abuse = FixMyStreet::App->model('DB::Abuse')->find( { email => $email } ); + my $abuse = FixMyStreet::DB->resultset('Abuse')->find( { email => $email } ); $abuse->delete if $abuse; $mech->get_ok( '/admin/update_edit/' . $update->id ); @@ -313,7 +313,7 @@ subtest 'adding email to abuse list from update page' => sub { $mech->content_contains('User added to abuse list'); $mech->content_contains('<small>User in abuse table</small>'); - $abuse = FixMyStreet::App->model('DB::Abuse')->find( { email => $email } ); + $abuse = FixMyStreet::DB->resultset('Abuse')->find( { email => $email } ); ok $abuse, 'entry created in abuse table'; $mech->get_ok( '/admin/update_edit/' . $update->id ); diff --git a/t/app/controller/around.t b/t/app/controller/around.t index b123692fa..5ef37f197 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -366,7 +366,7 @@ subtest 'check map zoom level customisation' => sub { subtest 'check nearby lookup' => sub { my $p = FixMyStreet::DB->resultset("Problem")->search({ external_body => "Pothole-confirmed" })->first; $mech->get_ok('/around/nearby?latitude=51.754926&longitude=-1.256179&filter_category=Pothole'); - $mech->content_contains('["51.754926","-1.256179","yellow",' . $p->id . ',"Around page Test 1 for ' . $body->id . '","small",false]'); + $mech->content_contains('[51.754926,-1.256179,"yellow",' . $p->id . ',"Around page Test 1 for ' . $body->id . '","small",false]'); }; done_testing(); diff --git a/t/app/controller/moderate.t b/t/app/controller/moderate.t index 7ef24bbe8..256122d9b 100644 --- a/t/app/controller/moderate.t +++ b/t/app/controller/moderate.t @@ -13,8 +13,6 @@ sub moderate_permission_title { 0 } package main; use FixMyStreet::TestMech; -use FixMyStreet::App; -use Data::Dumper; my $mech = FixMyStreet::TestMech->new; $mech->host('www.example.org'); @@ -29,7 +27,7 @@ my $user = $mech->create_user_ok('test-moderation@example.com', name => 'Test Us my $user2 = $mech->create_user_ok('test-moderation2@example.com', name => 'Test User 2'); sub create_report { - FixMyStreet::App->model('DB::Problem')->create( + FixMyStreet::DB->resultset('Problem')->create( { postcode => 'BR1 3SB', bodies_str => $body->id, diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index af18c39b9..ae6f760d8 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -1343,7 +1343,7 @@ subtest "test report creation for a category that is non public" => sub { $contact1->update( { non_public => 0 } ); }; -$contact2->category( "Pothol\xc3\xa9s" ); +$contact2->category( "Pothol\x{00E9}s" ); $contact2->update; subtest "check map click ajax response" => sub { diff --git a/t/app/controller/rss.t b/t/app/controller/rss.t index a8101b593..04e63711c 100644 --- a/t/app/controller/rss.t +++ b/t/app/controller/rss.t @@ -1,3 +1,4 @@ +use utf8; use open ':std', ':locale'; use FixMyStreet::TestMech; use FixMyStreet::App; @@ -97,7 +98,7 @@ $report->geocode( 'estimatedTotal' => 1 } ], - 'copyright' => "Copyright \x{a9} 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", + 'copyright' => "Copyright © 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", 'statusCode' => 200, 'authenticationResultCode' => 'ValidCredentials' } diff --git a/t/app/controller/token.t b/t/app/controller/token.t index 858838865..f7dec1a31 100644 --- a/t/app/controller/token.t +++ b/t/app/controller/token.t @@ -1,5 +1,4 @@ use FixMyStreet::TestMech; -use FixMyStreet::App; my $mech = FixMyStreet::TestMech->new; my $user = $mech->create_user_ok('bob@example.com', name => 'Bob'); @@ -8,7 +7,6 @@ subtest 'Zurich special case for C::Tokens->problem_confirm' => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => ['zurich'], }, sub { - my $c = FixMyStreet::App->new; my $zurich = $mech->create_body_ok( 1, 'Zurich' ); my ($report) = $mech->create_problems_for_body( 1, $zurich->id, @@ -19,7 +17,7 @@ subtest 'Zurich special case for C::Tokens->problem_confirm' => sub { }); is $report->get_extra_metadata('email_confirmed'), undef, 'email_confirmed not yet set (sanity)'; - my $token = $c->model('DB::Token')->create({ scope => 'problem', data => $report->id }); + my $token = FixMyStreet::DB->resultset('Token')->create({ scope => 'problem', data => $report->id }); $mech->get_ok('/P/' . $token->token); $report->discard_changes; diff --git a/t/app/helpers/send_email.t b/t/app/helpers/send_email.t index a692fb6bc..58b9acaaa 100644 --- a/t/app/helpers/send_email.t +++ b/t/app/helpers/send_email.t @@ -40,7 +40,7 @@ my $email = Email::MIME->new($email_as_string); my $expected_email_content = path(__FILE__)->parent->child('send_email_sample.txt')->slurp; my $name = FixMyStreet->config('CONTACT_NAME'); -my $sender = '"' . $name . '" <' . FixMyStreet->config('DO_NOT_REPLY_EMAIL') . '>'; +my $sender = $name . ' <' . FixMyStreet->config('DO_NOT_REPLY_EMAIL') . '>'; $expected_email_content =~ s{CONTACT_EMAIL}{$sender}; my $expected_email = Email::MIME->new($expected_email_content); diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t index 124e838ee..78574ac36 100644 --- a/t/app/model/alert_type.t +++ b/t/app/model/alert_type.t @@ -1,3 +1,4 @@ +use utf8; use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new(); @@ -253,7 +254,7 @@ $report->geocode( 'estimatedTotal' => 1 } ], - 'copyright' => "Copyright \x{a9} 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", + 'copyright' => "Copyright © 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.", 'statusCode' => 200, 'authenticationResultCode' => 'ValidCredentials' } diff --git a/t/cobrand/bucks.t b/t/cobrand/bucks.t index 965b90107..892bf617d 100644 --- a/t/cobrand/bucks.t +++ b/t/cobrand/bucks.t @@ -53,7 +53,7 @@ subtest 'flytipping on road sent to extra email' => sub { FixMyStreet::Script::Reports::send(); my @email = $mech->get_email; my $tfb = join('', 'illegaldumpingcosts', '@', 'buckscc.gov.uk'); - is $email[0]->header('To'), '"TfB" <' . $tfb . '>'; + is $email[0]->header('To'), 'TfB <' . $tfb . '>'; like $mech->get_text_body_from_email($email[1]), qr/report's reference number/; $report->discard_changes; is $report->external_id, 248, 'Report has right external ID'; @@ -84,7 +84,7 @@ subtest 'pothole on road not sent to extra email, only confirm sent' => sub { subtest 'flytipping off road sent to extra email' => sub { FixMyStreet::Script::Reports::send(); my @email = $mech->get_email; - is $email[0]->header('To'), '"Chiltern" <flytipping@chiltern>'; + is $email[0]->header('To'), 'Chiltern <flytipping@chiltern>'; like $mech->get_text_body_from_email($email[1]), qr/Please note that Buckinghamshire County Council is not responsible/; $report->discard_changes; is $report->external_id, undef, 'Report has right external ID'; diff --git a/t/cobrand/fixmystreet.t b/t/cobrand/fixmystreet.t index b47269db4..6095aee2a 100644 --- a/t/cobrand/fixmystreet.t +++ b/t/cobrand/fixmystreet.t @@ -1,3 +1,4 @@ +use utf8; use FixMyStreet::Script::UpdateAllReports; use FixMyStreet::TestMech; @@ -53,7 +54,7 @@ FixMyStreet::override_config { subtest 'check marketing dashboard csv' => sub { $mech->log_in_ok('someone@birmingham.gov.uk'); - $mech->create_problems_for_body(105, $body->id, 'Title', { + $mech->create_problems_for_body(105, $body->id, 'Titlē', { detail => "this report\nis split across\nseveral lines", areas => ",2514,", }); @@ -80,7 +81,7 @@ FixMyStreet::override_config { 'Column headers look correct'; my $body_id = $body->id; - like $rows[1]->[1], qr/Title Test \d+ for $body_id/, 'problem title correct'; + like $rows[1]->[1], qr/Titlē Test \d+ for $body_id/, 'problem title correct'; }; subtest 'check marketing dashboard contact listings' => sub { diff --git a/t/cobrand/restriction.t b/t/cobrand/restriction.t index 63fe326b1..185f365c8 100644 --- a/t/cobrand/restriction.t +++ b/t/cobrand/restriction.t @@ -19,7 +19,10 @@ package main; use FixMyStreet::TestMech; -my $c = FixMyStreet::App->new; +use Catalyst::Test 'FixMyStreet::App'; + +my ($res, $c) = ctx_request('/'); + my $cobrand = FixMyStreet::Cobrand::Tester->new({c => $c}); $c->stash->{cobrand} = $cobrand; diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index ee2724a07..0bfdd8351 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -1012,7 +1012,7 @@ subtest 'email images to external partners' => sub { $expected_email_content =~ s{Subject: (.*?)\r?\n}{ my $subj = Encode::decode('MIME-Header', $1); $subj =~ s{REPORT_ID}{$REPORT_ID}g; - 'Subject: ' . Email::MIME::Encode::mime_encode($subj, "utf-8") . "\n"; + 'Subject: ' . Email::MIME::Encode::mime_encode($subj, "utf-8", 9) . "\n"; }eg; $expected_email_content =~ s{REPORT_ID}{$REPORT_ID}g; $expected_email_content =~ s{BOUNDARY}{$boundary}g; diff --git a/t/cobrand/zurich_attachments.txt b/t/cobrand/zurich_attachments.txt index 25a1bacf0..26b7eb8ca 100644 --- a/t/cobrand/zurich_attachments.txt +++ b/t/cobrand/zurich_attachments.txt @@ -3,7 +3,7 @@ Subject: =?iso-8859-1?Q?Z=FCri?= wie neu: Weitergeleitete Meldung #REPORT_ID Content-Type: multipart/mixed; boundary="BOUNDARY"
To: "External Body" <external_body@example.net>
Content-Transfer-Encoding: 7bit
-From: "FixMyStreet" <division@example.org>
+From: FixMyStreet <division@example.org>
--BOUNDARY
|