Bug 25067: Move the tests to db_dependent
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 6 Nov 2020 14:30:39 +0000 (15:30 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 6 Nov 2020 14:39:59 +0000 (15:39 +0100)
To not break the package workflow

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
12 files changed:
t/db_dependent/misc/translator/sample.pref [new file with mode: 0644]
t/db_dependent/misc/translator/sample.tt [new file with mode: 0644]
t/db_dependent/misc/translator/sample.yml [new file with mode: 0644]
t/db_dependent/misc/translator/xgettext-installer.t [new file with mode: 0755]
t/db_dependent/misc/translator/xgettext-pref.t [new file with mode: 0755]
t/db_dependent/misc/translator/xgettext-tt2.t [new file with mode: 0755]
t/misc/translator/sample.pref [deleted file]
t/misc/translator/sample.tt [deleted file]
t/misc/translator/sample.yml [deleted file]
t/misc/translator/xgettext-installer.t [deleted file]
t/misc/translator/xgettext-pref.t [deleted file]
t/misc/translator/xgettext-tt2.t [deleted file]

diff --git a/t/db_dependent/misc/translator/sample.pref b/t/db_dependent/misc/translator/sample.pref
new file mode 100644 (file)
index 0000000..c42692b
--- /dev/null
@@ -0,0 +1,14 @@
+Section:
+    Subsection:
+        -
+            - pref: SamplePref
+              choices:
+                on: Do
+                off: Do not do
+            - that thing
+        -
+            - pref: MultiplePref
+              multiple:
+                foo: Foo ツ
+                bar: Bar
+                baz: Baz
diff --git a/t/db_dependent/misc/translator/sample.tt b/t/db_dependent/misc/translator/sample.tt
new file mode 100644 (file)
index 0000000..3fd4fca
--- /dev/null
@@ -0,0 +1,36 @@
+[% USE raw %]
+[% PROCESS 'i18n.inc' %]
+[% t('hello ツ') | $raw %]
+[% tx('hello {name}', { name = 'Bob' }) | $raw %]
+[% tn('item', 'items', count) | $raw %]
+[% tnx('{count} item', '{count} items', count, { count = count }) | $raw %]
+[% tp('context', 'hello') | $raw %]
+[% tpx('context', 'hello {name}', { name = 'Bob' }) | $raw %]
+[% tnp('context', 'item', 'items', count) | $raw %]
+[% tnpx('context', '{count} item', '{count} items', count, { count = count }) | $raw %]
+
+[% # it also works on multiple lines
+    tnpx (
+        'context',
+        '{count} item',
+        '{count} items',
+        count,
+        {
+            count = count,
+        }
+    ) | $raw
+%]
+
+[% # and t* calls can be nested
+    tx('status is {status}', {
+        status = active ? t('active') : t('inactive')
+    }) | $raw
+%]
+
+[%# but a TT comment won't get picked
+    t('not translatable')
+%]
+
+[% BLOCK %]
+    [% t('Inside block') | $raw %]
+[% END %]
diff --git a/t/db_dependent/misc/translator/sample.yml b/t/db_dependent/misc/translator/sample.yml
new file mode 100644 (file)
index 0000000..d6d675f
--- /dev/null
@@ -0,0 +1,15 @@
+description:
+  - "Sample installer file"
+
+tables:
+  - table1:
+        translatable: [ column1, column2 ]
+        multiline: [ column2 ]
+        rows:
+          - column1: foo ツ
+            column2:
+              - bar
+              - baz
+            column3: qux
+            column4:
+              - quux
diff --git a/t/db_dependent/misc/translator/xgettext-installer.t b/t/db_dependent/misc/translator/xgettext-installer.t
new file mode 100755 (executable)
index 0000000..4043610
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+use Modern::Perl;
+
+use File::Slurp;
+use File::Temp qw(tempdir);
+use FindBin qw($Bin);
+use Locale::PO;
+use Test::More tests => 4;
+
+my $tempdir = tempdir(CLEANUP => 1);
+
+write_file("$tempdir/files", "$Bin/sample.yml");
+
+my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-installer "
+    . "-o $tempdir/Koha.pot -f $tempdir/files";
+
+system($xgettext_cmd);
+my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
+
+my @expected = (
+    { msgid => '"Sample installer file"' },
+    { msgid => '"bar"' },
+    { msgid => '"baz"' },
+    { msgid => '"foo ツ"' },
+);
+
+for (my $i = 0; $i < @expected; $i++) {
+    my $expected = $expected[$i]->{msgid};
+    my $expected_str = defined $expected ? $expected : 'not defined';
+    is($pot->[$i + 1]->msgid, $expected, "$i: msgid is $expected_str");
+}
diff --git a/t/db_dependent/misc/translator/xgettext-pref.t b/t/db_dependent/misc/translator/xgettext-pref.t
new file mode 100755 (executable)
index 0000000..8c699fe
--- /dev/null
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+
+use Modern::Perl;
+
+use File::Slurp;
+use File::Temp qw(tempdir);
+use FindBin qw($Bin);
+use Locale::PO;
+use Test::More tests => 16;
+
+my $tempdir = tempdir(CLEANUP => 1);
+
+write_file("$tempdir/files", "$Bin/sample.pref");
+
+my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-pref "
+    . "-o $tempdir/Koha.pot -f $tempdir/files";
+
+system($xgettext_cmd);
+my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
+
+my @expected = (
+    {
+        msgid => '"sample.pref"',
+    },
+    {
+        msgid => '"sample.pref Subsection"',
+    },
+    {
+        msgid => '"sample.pref#MultiplePref# Bar"',
+    },
+    {
+        msgid => '"sample.pref#MultiplePref# Baz"',
+    },
+    {
+        msgid => '"sample.pref#MultiplePref# Foo ツ"',
+    },
+    {
+        msgid => '"sample.pref#SamplePref# Do"',
+    },
+    {
+        msgid => '"sample.pref#SamplePref# Do not do"',
+    },
+    {
+        msgid => '"sample.pref#SamplePref# that thing"',
+    },
+);
+
+for (my $i = 0; $i < @expected; $i++) {
+    for my $key (qw(msgid msgctxt)) {
+        my $expected = $expected[$i]->{$key};
+        my $expected_str = defined $expected ? $expected : 'not defined';
+        is($pot->[$i + 1]->$key, $expected, "$i: $key is $expected_str");
+    }
+}
diff --git a/t/db_dependent/misc/translator/xgettext-tt2.t b/t/db_dependent/misc/translator/xgettext-tt2.t
new file mode 100755 (executable)
index 0000000..e2ae734
--- /dev/null
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+
+use Modern::Perl;
+
+use File::Slurp;
+use File::Temp qw(tempdir);
+use FindBin qw($Bin);
+use Locale::PO;
+use Test::More tests => 36;
+
+my $tempdir = tempdir(CLEANUP => 1);
+
+write_file("$tempdir/files", "$Bin/sample.tt");
+
+my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-tt2 --from-code=UTF-8 "
+    . "-o $tempdir/Koha.pot -f $tempdir/files";
+
+system($xgettext_cmd);
+my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
+
+my @expected = (
+    {
+        msgid => '"hello ツ"',
+    },
+    {
+        msgid => '"hello {name}"',
+    },
+    {
+        msgid => '"item"',
+        msgid_plural => '"items"',
+    },
+    {
+        msgid => '"{count} item"',
+        msgid_plural => '"{count} items"',
+    },
+    {
+        msgid => '"hello"',
+        msgctxt => '"context"',
+    },
+    {
+        msgid => '"hello {name}"',
+        msgctxt => '"context"',
+    },
+    {
+        msgid => '"item"',
+        msgid_plural => '"items"',
+        msgctxt => '"context"',
+    },
+    {
+        msgid => '"{count} item"',
+        msgid_plural => '"{count} items"',
+        msgctxt => '"context"',
+    },
+    {
+        msgid => '"status is {status}"',
+    },
+    {
+        msgid => '"active"',
+    },
+    {
+        msgid => '"inactive"',
+    },
+    {
+        msgid => '"Inside block"',
+    },
+);
+
+for (my $i = 0; $i < @expected; $i++) {
+    for my $key (qw(msgid msgid_plural msgctxt)) {
+        my $expected = $expected[$i]->{$key};
+        my $expected_str = defined $expected ? $expected : 'not defined';
+        is($pot->[$i + 1]->$key, $expected, "$i: $key is $expected_str");
+    }
+}
diff --git a/t/misc/translator/sample.pref b/t/misc/translator/sample.pref
deleted file mode 100644 (file)
index c42692b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-Section:
-    Subsection:
-        -
-            - pref: SamplePref
-              choices:
-                on: Do
-                off: Do not do
-            - that thing
-        -
-            - pref: MultiplePref
-              multiple:
-                foo: Foo ツ
-                bar: Bar
-                baz: Baz
diff --git a/t/misc/translator/sample.tt b/t/misc/translator/sample.tt
deleted file mode 100644 (file)
index 3fd4fca..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-[% USE raw %]
-[% PROCESS 'i18n.inc' %]
-[% t('hello ツ') | $raw %]
-[% tx('hello {name}', { name = 'Bob' }) | $raw %]
-[% tn('item', 'items', count) | $raw %]
-[% tnx('{count} item', '{count} items', count, { count = count }) | $raw %]
-[% tp('context', 'hello') | $raw %]
-[% tpx('context', 'hello {name}', { name = 'Bob' }) | $raw %]
-[% tnp('context', 'item', 'items', count) | $raw %]
-[% tnpx('context', '{count} item', '{count} items', count, { count = count }) | $raw %]
-
-[% # it also works on multiple lines
-    tnpx (
-        'context',
-        '{count} item',
-        '{count} items',
-        count,
-        {
-            count = count,
-        }
-    ) | $raw
-%]
-
-[% # and t* calls can be nested
-    tx('status is {status}', {
-        status = active ? t('active') : t('inactive')
-    }) | $raw
-%]
-
-[%# but a TT comment won't get picked
-    t('not translatable')
-%]
-
-[% BLOCK %]
-    [% t('Inside block') | $raw %]
-[% END %]
diff --git a/t/misc/translator/sample.yml b/t/misc/translator/sample.yml
deleted file mode 100644 (file)
index d6d675f..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-description:
-  - "Sample installer file"
-
-tables:
-  - table1:
-        translatable: [ column1, column2 ]
-        multiline: [ column2 ]
-        rows:
-          - column1: foo ツ
-            column2:
-              - bar
-              - baz
-            column3: qux
-            column4:
-              - quux
diff --git a/t/misc/translator/xgettext-installer.t b/t/misc/translator/xgettext-installer.t
deleted file mode 100755 (executable)
index 4043610..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/perl
-
-use Modern::Perl;
-
-use File::Slurp;
-use File::Temp qw(tempdir);
-use FindBin qw($Bin);
-use Locale::PO;
-use Test::More tests => 4;
-
-my $tempdir = tempdir(CLEANUP => 1);
-
-write_file("$tempdir/files", "$Bin/sample.yml");
-
-my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-installer "
-    . "-o $tempdir/Koha.pot -f $tempdir/files";
-
-system($xgettext_cmd);
-my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
-
-my @expected = (
-    { msgid => '"Sample installer file"' },
-    { msgid => '"bar"' },
-    { msgid => '"baz"' },
-    { msgid => '"foo ツ"' },
-);
-
-for (my $i = 0; $i < @expected; $i++) {
-    my $expected = $expected[$i]->{msgid};
-    my $expected_str = defined $expected ? $expected : 'not defined';
-    is($pot->[$i + 1]->msgid, $expected, "$i: msgid is $expected_str");
-}
diff --git a/t/misc/translator/xgettext-pref.t b/t/misc/translator/xgettext-pref.t
deleted file mode 100755 (executable)
index 8c699fe..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/perl
-
-use Modern::Perl;
-
-use File::Slurp;
-use File::Temp qw(tempdir);
-use FindBin qw($Bin);
-use Locale::PO;
-use Test::More tests => 16;
-
-my $tempdir = tempdir(CLEANUP => 1);
-
-write_file("$tempdir/files", "$Bin/sample.pref");
-
-my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-pref "
-    . "-o $tempdir/Koha.pot -f $tempdir/files";
-
-system($xgettext_cmd);
-my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
-
-my @expected = (
-    {
-        msgid => '"sample.pref"',
-    },
-    {
-        msgid => '"sample.pref Subsection"',
-    },
-    {
-        msgid => '"sample.pref#MultiplePref# Bar"',
-    },
-    {
-        msgid => '"sample.pref#MultiplePref# Baz"',
-    },
-    {
-        msgid => '"sample.pref#MultiplePref# Foo ツ"',
-    },
-    {
-        msgid => '"sample.pref#SamplePref# Do"',
-    },
-    {
-        msgid => '"sample.pref#SamplePref# Do not do"',
-    },
-    {
-        msgid => '"sample.pref#SamplePref# that thing"',
-    },
-);
-
-for (my $i = 0; $i < @expected; $i++) {
-    for my $key (qw(msgid msgctxt)) {
-        my $expected = $expected[$i]->{$key};
-        my $expected_str = defined $expected ? $expected : 'not defined';
-        is($pot->[$i + 1]->$key, $expected, "$i: $key is $expected_str");
-    }
-}
diff --git a/t/misc/translator/xgettext-tt2.t b/t/misc/translator/xgettext-tt2.t
deleted file mode 100755 (executable)
index e2ae734..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/perl
-
-use Modern::Perl;
-
-use File::Slurp;
-use File::Temp qw(tempdir);
-use FindBin qw($Bin);
-use Locale::PO;
-use Test::More tests => 36;
-
-my $tempdir = tempdir(CLEANUP => 1);
-
-write_file("$tempdir/files", "$Bin/sample.tt");
-
-my $xgettext_cmd = "$Bin/../../../misc/translator/xgettext-tt2 --from-code=UTF-8 "
-    . "-o $tempdir/Koha.pot -f $tempdir/files";
-
-system($xgettext_cmd);
-my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot");
-
-my @expected = (
-    {
-        msgid => '"hello ツ"',
-    },
-    {
-        msgid => '"hello {name}"',
-    },
-    {
-        msgid => '"item"',
-        msgid_plural => '"items"',
-    },
-    {
-        msgid => '"{count} item"',
-        msgid_plural => '"{count} items"',
-    },
-    {
-        msgid => '"hello"',
-        msgctxt => '"context"',
-    },
-    {
-        msgid => '"hello {name}"',
-        msgctxt => '"context"',
-    },
-    {
-        msgid => '"item"',
-        msgid_plural => '"items"',
-        msgctxt => '"context"',
-    },
-    {
-        msgid => '"{count} item"',
-        msgid_plural => '"{count} items"',
-        msgctxt => '"context"',
-    },
-    {
-        msgid => '"status is {status}"',
-    },
-    {
-        msgid => '"active"',
-    },
-    {
-        msgid => '"inactive"',
-    },
-    {
-        msgid => '"Inside block"',
-    },
-);
-
-for (my $i = 0; $i < @expected; $i++) {
-    for my $key (qw(msgid msgid_plural msgctxt)) {
-        my $expected = $expected[$i]->{$key};
-        my $expected_str = defined $expected ? $expected : 'not defined';
-        is($pot->[$i + 1]->$key, $expected, "$i: $key is $expected_str");
-    }
-}