Bug 18951: Some t/Biblio tests are database dependent (git mv)
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wed, 19 Jul 2017 11:33:34 +0000 (13:33 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 24 Jul 2017 16:37:18 +0000 (13:37 -0300)
Move Isbd.t and TransformKohaToMarc.t to db_dependent.
Next patch will add a few adjustments too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/Biblio/Isbd.t [deleted file]
t/Biblio/TransformKohaToMarc.t [deleted file]
t/db_dependent/Biblio/Isbd.t [new file with mode: 0644]
t/db_dependent/Biblio/TransformKohaToMarc.t [new file with mode: 0644]

diff --git a/t/Biblio/Isbd.t b/t/Biblio/Isbd.t
deleted file mode 100644 (file)
index be790e9..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/perl
-
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# Koha is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Koha; if not, see <http://www.gnu.org/licenses>.
-
-use Modern::Perl;
-
-use Test::More tests => 3;
-use Test::MockModule;
-use MARC::Record;
-use t::lib::Mocks qw( mock_preference );
-
-BEGIN {
-        use_ok('C4::Biblio');
-}
-
-my $dbh = C4::Context->dbh;
-# Start transaction
-$dbh->{AutoCommit} = 0;
-$dbh->{RaiseError} = 1;
-
-my $template = '#200|<h2>Title : |{200a}{ by 200f}|</h2>';
-my $opac_template = '#200|<h2>Title : |{200a}{ (200f)}|</h2>';
-t::lib::Mocks::mock_preference('isbd', $template);
-t::lib::Mocks::mock_preference('opacisbd', $opac_template);
-
-my $record = MARC::Record->new();
-$record->append_fields(
-    MARC::Field->new('200', '', '', 'a' => 'Mountains'),
-    MARC::Field->new('200', '', '', 'f' => 'Keith Lye'),
-);
-my ($bibnum, $title, $bibitemnum) = AddBiblio($record, '');
-
-my $isbd = GetISBDView({ record => $record });
-is($isbd, '<h2>Title : Mountains by Keith Lye</h2>', 'ISBD is correct');
-
-my $opacisbd = GetISBDView({ record => $record, template => 'opac' });
-is($opacisbd, '<h2>Title : Mountains (Keith Lye)</h2>', 'OPAC ISBD is correct');
diff --git a/t/Biblio/TransformKohaToMarc.t b/t/Biblio/TransformKohaToMarc.t
deleted file mode 100644 (file)
index 15eb71a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-use Modern::Perl;
-use Test::More tests => 1;
-use MARC::Record;
-
-use t::lib::Mocks;
-use C4::Biblio;
-
-t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
-
-my $record = C4::Biblio::TransformKohaToMarc({
-    "biblioitems.illus"   => "Other physical details", # 300$b
-    "biblioitems.pages"   => "Extent",                 # 300$a
-    "biblioitems.size"    => "Dimensions",             # 300$c
-});
-
-my @subfields = $record->field('300')->subfields();
-is_deeply( \@subfields, [
-          [
-            'a',
-            'Extent'
-          ],
-          [
-            'b',
-            'Other physical details'
-          ],
-          [
-            'c',
-            'Dimensions'
-          ]
-        ],
-'TransformKohaToMarc should returns sorted subfields (regression test for bug 12343)' );
diff --git a/t/db_dependent/Biblio/Isbd.t b/t/db_dependent/Biblio/Isbd.t
new file mode 100644 (file)
index 0000000..be790e9
--- /dev/null
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
+
+use Modern::Perl;
+
+use Test::More tests => 3;
+use Test::MockModule;
+use MARC::Record;
+use t::lib::Mocks qw( mock_preference );
+
+BEGIN {
+        use_ok('C4::Biblio');
+}
+
+my $dbh = C4::Context->dbh;
+# Start transaction
+$dbh->{AutoCommit} = 0;
+$dbh->{RaiseError} = 1;
+
+my $template = '#200|<h2>Title : |{200a}{ by 200f}|</h2>';
+my $opac_template = '#200|<h2>Title : |{200a}{ (200f)}|</h2>';
+t::lib::Mocks::mock_preference('isbd', $template);
+t::lib::Mocks::mock_preference('opacisbd', $opac_template);
+
+my $record = MARC::Record->new();
+$record->append_fields(
+    MARC::Field->new('200', '', '', 'a' => 'Mountains'),
+    MARC::Field->new('200', '', '', 'f' => 'Keith Lye'),
+);
+my ($bibnum, $title, $bibitemnum) = AddBiblio($record, '');
+
+my $isbd = GetISBDView({ record => $record });
+is($isbd, '<h2>Title : Mountains by Keith Lye</h2>', 'ISBD is correct');
+
+my $opacisbd = GetISBDView({ record => $record, template => 'opac' });
+is($opacisbd, '<h2>Title : Mountains (Keith Lye)</h2>', 'OPAC ISBD is correct');
diff --git a/t/db_dependent/Biblio/TransformKohaToMarc.t b/t/db_dependent/Biblio/TransformKohaToMarc.t
new file mode 100644 (file)
index 0000000..15eb71a
--- /dev/null
@@ -0,0 +1,31 @@
+use Modern::Perl;
+use Test::More tests => 1;
+use MARC::Record;
+
+use t::lib::Mocks;
+use C4::Biblio;
+
+t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
+
+my $record = C4::Biblio::TransformKohaToMarc({
+    "biblioitems.illus"   => "Other physical details", # 300$b
+    "biblioitems.pages"   => "Extent",                 # 300$a
+    "biblioitems.size"    => "Dimensions",             # 300$c
+});
+
+my @subfields = $record->field('300')->subfields();
+is_deeply( \@subfields, [
+          [
+            'a',
+            'Extent'
+          ],
+          [
+            'b',
+            'Other physical details'
+          ],
+          [
+            'c',
+            'Dimensions'
+          ]
+        ],
+'TransformKohaToMarc should returns sorted subfields (regression test for bug 12343)' );