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

(-)a/t/Koha.t (-5 / +39 lines)
Lines 25-31 use Module::Load::Conditional qw/check_install/; Link Here
25
25
26
BEGIN {
26
BEGIN {
27
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
27
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
28
        plan tests => 30;
28
        plan tests => 31;
29
    } else {
29
    } else {
30
        plan skip_all => "Need Test::DBIx::Class"
30
        plan skip_all => "Need Test::DBIx::Class"
31
    }
31
    }
Lines 38-52 use Test::DBIx::Class { Link Here
38
    connect_info => ['dbi:SQLite:dbname=:memory:','',''],
38
    connect_info => ['dbi:SQLite:dbname=:memory:','',''],
39
    connect_opts => { name_sep => '.', quote_char => '`', },
39
    connect_opts => { name_sep => '.', quote_char => '`', },
40
    fixture_class => '::Populate',
40
    fixture_class => '::Populate',
41
}, 'AuthorisedValue' ;
41
}, 'AuthorisedValue', 'Branch' ;
42
42
43
sub fixtures {
43
sub fixtures {
44
    my ( $data ) = @_;
44
    my ( $av, $libraries ) = @_;
45
    fixtures_ok [
45
    fixtures_ok [
46
        AuthorisedValue => [
46
        AuthorisedValue => [
47
            [ 'category', 'authorised_value' ],
47
            [ 'category', 'authorised_value' ],
48
            @$data,
48
            @$av,
49
        ],
49
        ],
50
        Branch => [
51
            ['branchcode', 'branchname'],
52
            @$libraries,
53
        ]
50
    ], 'add fixtures';
54
    ], 'add fixtures';
51
}
55
}
52
56
Lines 57-63 my $authorised_values = [ Link Here
57
    ['LOC', 'LOC'],
61
    ['LOC', 'LOC'],
58
    ['RELTERMS', 'RELTERMS'],
62
    ['RELTERMS', 'RELTERMS'],
59
];
63
];
60
fixtures($authorised_values);
64
my $libraries = [
65
    ['XXX_test', 'my branchname XXX'],
66
];
67
fixtures($authorised_values, $libraries);
61
68
62
is ( IsAuthorisedValueCategory('LOC'), 1, 'LOC is a valid authorized value category');
69
is ( IsAuthorisedValueCategory('LOC'), 1, 'LOC is a valid authorized value category');
63
is ( IsAuthorisedValueCategory('something'), 0, 'something is not a valid authorized value category');
70
is ( IsAuthorisedValueCategory('something'), 0, 'something is not a valid authorized value category');
Lines 119-122 is( C4::Koha::GetNormalizedISBN('9781250075345 (hardcover) | 1250075343 (hardcov Link Here
119
is( C4::Koha::GetNormalizedISBN('9781250067128 | 125006712X'), '125006712X', 'Test GetNormalizedISBN' );
126
is( C4::Koha::GetNormalizedISBN('9781250067128 | 125006712X'), '125006712X', 'Test GetNormalizedISBN' );
120
is( C4::Koha::GetNormalizedISBN('9780373211463 | 0373211465'), '0373211465', 'Test GetNormalizedISBN' );
127
is( C4::Koha::GetNormalizedISBN('9780373211463 | 0373211465'), '0373211465', 'Test GetNormalizedISBN' );
121
128
129
130
subtest 'getFacets() tests' => sub {
131
    plan tests => 5;
132
133
    is ( Koha::Libraries->search->count, 1, 'There should be only 1 library (singleBranchMode on)' );
134
    my $facets = C4::Koha::getFacets();
135
    is(
136
        scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ),
137
        1,
138
        'location facet present with singleBranchMode on (bug 10078)'
139
    );
140
141
    $libraries = [
142
        ['YYY_test', 'my branchname YYY'],
143
        ['ZZZ_test', 'my branchname XXX'],
144
    ];
145
    fixtures($authorised_values, $libraries);
146
    is ( Koha::Libraries->search->count, 3, 'There should be only more than 1 library (singleBranchMode off)' );
147
148
    $facets = C4::Koha::getFacets();
149
    is(
150
        scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ),
151
        1,
152
        'location facet present with singleBranchMode off (bug 10078)'
153
    );
154
};
155
122
1;
156
1;
(-)a/t/db_dependent/Koha.t (-21 / +1 lines)
Lines 8-14 use warnings; Link Here
8
use C4::Context;
8
use C4::Context;
9
use Koha::DateUtils qw(dt_from_string);
9
use Koha::DateUtils qw(dt_from_string);
10
10
11
use Test::More tests => 10;
11
use Test::More tests => 9;
12
use DateTime::Format::MySQL;
12
use DateTime::Format::MySQL;
13
13
14
BEGIN {
14
BEGIN {
Lines 236-260 subtest 'Date and ISBN tests' => sub { Link Here
236
236
237
};
237
};
238
238
239
subtest 'getFacets() tests' => sub {
240
    plan tests => 2;
241
242
    C4::Context->set_preference('singleBranchMode', 0);
243
    my $facets = C4::Koha::getFacets();
244
    is(
245
        scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ),
246
        1,
247
        'location facet present with singleBranchMode off (bug 10078)'
248
    );
249
    C4::Context->set_preference('singleBranchMode', 1);
250
    $facets = C4::Koha::getFacets();
251
    is(
252
        scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ),
253
        1,
254
        'location facet present with singleBranchMode on (bug 10078)'
255
    );
256
};
257
258
subtest 'GetFrameworksLoop() tests' => sub {
239
subtest 'GetFrameworksLoop() tests' => sub {
259
    plan tests => 6;
240
    plan tests => 6;
260
241
261
- 

Return to bug 4941