aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-08-15 11:01:08 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-08-15 15:19:23 +0100
commit6c5ad8168b0d42f51caba7a8e999e448b750ed41 (patch)
treecabdfe6b4564e9c0fe2ce383e9498026bbf64b89 /t
parent5101c6fc13e4199ec8cb07fd0d405a6dcea68a60 (diff)
Ignore translation if fewer than two languages.
Diffstat (limited to 't')
-rw-r--r--t/roles/translatable.t36
1 files changed, 21 insertions, 15 deletions
diff --git a/t/roles/translatable.t b/t/roles/translatable.t
index 71e39c360..e13f49fc6 100644
--- a/t/roles/translatable.t
+++ b/t/roles/translatable.t
@@ -41,31 +41,37 @@ 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";
+# Multiple LANGUAGES so translation code is called
+FixMyStreet::override_config {
+ LANGUAGES => [ 'en-gb,English,en_GB', 'de,German,de_DE' ]
+}, sub {
+ 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::DB->schema->lang("de");
+ is $body->name, "Dunkirk";
+ is $contact->category_display, "Schlaglöcher";
+ is $problem->category_display, "Schlaglöcher";
-is $contact->translation_for('category', 'de')->msgstr, "Schlaglöcher";
-is $body->translation_for('name', 'fr')->msgstr, "Dunkerque";
+ is $contact->translation_for('category', 'de')->msgstr, "Schlaglöcher";
+ is $body->translation_for('name', 'fr')->msgstr, "Dunkerque";
-ok $body->add_translation_for('name', 'es', 'Dunkerque');
+ ok $body->add_translation_for('name', 'es', 'Dunkerque');
-FixMyStreet::DB->schema->lang("es");
-is $body->name, "Dunkerque";
+ FixMyStreet::DB->schema->lang("es");
+ is $body->name, "Dunkerque";
-is $body->translation_for('name')->count, 2;
+ is $body->translation_for('name')->count, 2;
+};
FixMyStreet::override_config {
+ LANGUAGES => [ 'en-gb,English,en_GB', 'nb,Norwegian,nb_NO' ],
ALLOWED_COBRANDS => [ 'fiksgatami' ],
}, sub {
$mech->get_ok($problem->url);
- $mech->content_contains('Hull i veien');
+ $mech->content_contains('Hull i veien');
};
done_testing;