diff options
Diffstat (limited to 't/roles')
-rw-r--r-- | t/roles/translatable.t | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/t/roles/translatable.t b/t/roles/translatable.t index a33b2d9d0..bbe05ce9f 100644 --- a/t/roles/translatable.t +++ b/t/roles/translatable.t @@ -2,6 +2,11 @@ use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; my $body = FixMyStreet::DB->resultset("Body")->create({ name => 'Dunkirk' }); +my $contact = $mech->create_contact_ok( + body => $body, + email => 'potholes@dunkirk', + category => 'Potholes' +); FixMyStreet::DB->resultset("Translation")->create({ lang => "fr", @@ -11,12 +16,46 @@ FixMyStreet::DB->resultset("Translation")->create({ msgstr => "Dunkerque", }); +FixMyStreet::DB->resultset("Translation")->create({ + lang => "de", + tbl => "contact", + object_id => $contact->id, + col => "category", + msgstr => "Schlaglöcher", +}); + +FixMyStreet::DB->resultset("Translation")->create({ + lang => "nb", + tbl => "contact", + object_id => $contact->id, + col => "category", + msgstr => "Hull i veien", +}); + +my ($problem) = $mech->create_problems_for_body(1, $body->id, "Title", { + whensent => \'current_timestamp', + category => 'Potholes', +}); + is $body->name, "Dunkirk"; +is $contact->category_display, "Potholes"; +is $problem->category_display, "Potholes"; FixMyStreet::DB->schema->lang("fr"); is $body->name, "Dunkerque"; +is $contact->category_display, "Potholes"; +is $problem->category_display, "Potholes"; FixMyStreet::DB->schema->lang("de"); is $body->name, "Dunkirk"; +is $contact->category_display, "Schlaglöcher"; +is $problem->category_display, "Schlaglöcher"; + +FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'fiksgatami' ], +}, sub { + $mech->get_ok($problem->url); + $mech->content_contains('Hull i veien'); +}; done_testing; |