|
Line 0
Link Here
|
| 0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
| 3 |
# This file is part of Koha. |
| 4 |
# |
| 5 |
# Koha is free software; you can redistribute it and/or modify it |
| 6 |
# under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# Koha is distributed in the hope that it will be useful, but |
| 11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 17 |
|
| 18 |
use Modern::Perl; |
| 19 |
|
| 20 |
use Test::More tests => 3; |
| 21 |
use Test::MockModule; |
| 22 |
use MARC::Record; |
| 23 |
use t::lib::Mocks qw( mock_preference ); |
| 24 |
|
| 25 |
BEGIN { |
| 26 |
use_ok('C4::Biblio'); |
| 27 |
} |
| 28 |
|
| 29 |
my $dbh = C4::Context->dbh; |
| 30 |
# Start transaction |
| 31 |
$dbh->{AutoCommit} = 0; |
| 32 |
$dbh->{RaiseError} = 1; |
| 33 |
|
| 34 |
my $template = '#200|<h2>Title : |{200a}{ by 200f}|</h2>'; |
| 35 |
my $opac_template = '#200|<h2>Title : |{200a}{ (200f)}|</h2>'; |
| 36 |
t::lib::Mocks::mock_preference('isbd', $template); |
| 37 |
t::lib::Mocks::mock_preference('opacisbd', $opac_template); |
| 38 |
|
| 39 |
my $record = MARC::Record->new(); |
| 40 |
$record->append_fields( |
| 41 |
MARC::Field->new('200', '', '', 'a' => 'Montains'), |
| 42 |
MARC::Field->new('200', '', '', 'f' => 'Keith Lye'), |
| 43 |
); |
| 44 |
my ($bibnum, $title, $bibitemnum) = AddBiblio($record, ''); |
| 45 |
|
| 46 |
my $isbd = GetISBDView($bibnum); |
| 47 |
is($isbd, '<h2>Title : Montains by Keith Lye</h2>', 'ISBD is correct'); |
| 48 |
|
| 49 |
my $opacisbd = GetISBDView($bibnum, 'opac'); |
| 50 |
is($opacisbd, '<h2>Title : Montains (Keith Lye)</h2>', 'OPAC ISBD is correct'); |