Bug 27461: Add tests for biblio_008
Test plan:
Run t/db_dependent/FrameworkPlugin.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 218c44c395)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
207b539406
commit
000b90ebb9
|
|
@ -4,14 +4,16 @@ use CGI;
|
|||
use File::Temp qw/tempfile/;
|
||||
use Getopt::Long;
|
||||
use Test::MockModule;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 6;
|
||||
|
||||
use t::lib::Mocks;
|
||||
use t::lib::TestBuilder;
|
||||
|
||||
use C4::Auth;
|
||||
use C4::Output;
|
||||
use Koha::Database;
|
||||
use Koha::FrameworkPlugin;
|
||||
use Koha::Util::FrameworkPlugin qw( biblio_008 );
|
||||
|
||||
our @includes;
|
||||
GetOptions( 'include=s{,}' => \@includes ); #not used by default !
|
||||
|
|
@ -39,6 +41,23 @@ subtest 'Test04 -- tests with new style plugin' => sub {
|
|||
subtest 'Test05 -- tests with build and launch for default plugins' => sub {
|
||||
test05( \@includes );
|
||||
};
|
||||
|
||||
subtest 'Test06 -- test biblio_008' => sub {
|
||||
plan tests => 5;
|
||||
t::lib::Mocks::mock_preference('DefaultCountryField008', 'nl' ); # deliberately shorter than 3 pos
|
||||
t::lib::Mocks::mock_preference('DefaultLanguageField008', 'dutch' ); # deliberately too long
|
||||
my $field = biblio_008();
|
||||
is( length($field), 40, 'Check length' );
|
||||
is( substr($field, 15, 3), 'nl ', 'Check country right padded' );
|
||||
is( substr($field, 35, 3), 'dut', 'Check language' );
|
||||
t::lib::Mocks::mock_preference('DefaultCountryField008', '' );
|
||||
$field = biblio_008();
|
||||
is( substr($field, 15, 3), '|||', 'Check country fallback for empty string' );
|
||||
t::lib::Mocks::mock_preference('DefaultCountryField008', undef );
|
||||
$field = biblio_008();
|
||||
is( substr($field, 15, 3), '|||', 'Check country fallback for undefined' );
|
||||
};
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
|
||||
sub test01 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue