View | Details | Raw Unified | Return to bug 27461
Collapse All | Expand All

(-)a/t/db_dependent/FrameworkPlugin.t (-2 / +20 lines)
Lines 4-17 use CGI; Link Here
4
use File::Temp qw/tempfile/;
4
use File::Temp qw/tempfile/;
5
use Getopt::Long;
5
use Getopt::Long;
6
use Test::MockModule;
6
use Test::MockModule;
7
use Test::More tests => 5;
7
use Test::More tests => 6;
8
8
9
use t::lib::Mocks;
9
use t::lib::TestBuilder;
10
use t::lib::TestBuilder;
10
11
11
use C4::Auth qw( checkauth );
12
use C4::Auth qw( checkauth );
12
use C4::Output qw( output_html_with_http_headers );
13
use C4::Output qw( output_html_with_http_headers );
13
use Koha::Database;
14
use Koha::Database;
14
use Koha::FrameworkPlugin;
15
use Koha::FrameworkPlugin;
16
use Koha::Util::FrameworkPlugin qw( biblio_008 );
15
17
16
our @includes;
18
our @includes;
17
GetOptions( 'include=s{,}' => \@includes ); #not used by default !
19
GetOptions( 'include=s{,}' => \@includes ); #not used by default !
Lines 39-44 subtest 'Test04 -- tests with new style plugin' => sub { Link Here
39
subtest 'Test05 -- tests with build and launch for default plugins' => sub {
41
subtest 'Test05 -- tests with build and launch for default plugins' => sub {
40
    test05( \@includes );
42
    test05( \@includes );
41
};
43
};
44
45
subtest 'Test06 -- test biblio_008' => sub {
46
    plan tests => 5;
47
    t::lib::Mocks::mock_preference('DefaultCountryField008', 'nl' ); # deliberately shorter than 3 pos
48
    t::lib::Mocks::mock_preference('DefaultLanguageField008', 'dutch' ); # deliberately too long
49
    my $field = biblio_008();
50
    is( length($field), 40, 'Check length' );
51
    is( substr($field, 15, 3), 'nl ', 'Check country right padded' );
52
    is( substr($field, 35, 3), 'dut', 'Check language' );
53
    t::lib::Mocks::mock_preference('DefaultCountryField008', '' );
54
    $field = biblio_008();
55
    is( substr($field, 15, 3), '|||', 'Check country fallback for empty string' );
56
    t::lib::Mocks::mock_preference('DefaultCountryField008', undef );
57
    $field = biblio_008();
58
    is( substr($field, 15, 3), '|||', 'Check country fallback for undefined' );
59
};
60
42
$schema->storage->txn_rollback;
61
$schema->storage->txn_rollback;
43
62
44
sub test01 {
63
sub test01 {
45
- 

Return to bug 27461