|
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 => 33; |
28 |
plan tests => 34; |
| 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 117-120
is( C4::Koha::GetNormalizedISBN(), undef, 'GetNormalizedISBN should return undef
Link Here
|
| 117 |
is( C4::Koha::GetNormalizedEAN(), undef, 'GetNormalizedEAN should return undef if no record and no isbn are passed' ); |
124 |
is( C4::Koha::GetNormalizedEAN(), undef, 'GetNormalizedEAN should return undef if no record and no isbn are passed' ); |
| 118 |
is( C4::Koha::GetNormalizedOCLCNumber(), undef, 'GetNormalizedOCLCNumber should return undef if no record and no isbn are passed' ); |
125 |
is( C4::Koha::GetNormalizedOCLCNumber(), undef, 'GetNormalizedOCLCNumber should return undef if no record and no isbn are passed' ); |
| 119 |
|
126 |
|
|
|
127 |
subtest 'getFacets() tests' => sub { |
| 128 |
plan tests => 5; |
| 129 |
|
| 130 |
is ( Koha::Libraries->search->count, 1, 'There should be only 1 library (singleBranchMode on)' ); |
| 131 |
my $facets = C4::Koha::getFacets(); |
| 132 |
is( |
| 133 |
scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ), |
| 134 |
1, |
| 135 |
'location facet present with singleBranchMode on (bug 10078)' |
| 136 |
); |
| 137 |
|
| 138 |
$libraries = [ |
| 139 |
['YYY_test', 'my branchname YYY'], |
| 140 |
['ZZZ_test', 'my branchname XXX'], |
| 141 |
]; |
| 142 |
fixtures($authorised_values, $libraries); |
| 143 |
is ( Koha::Libraries->search->count, 3, 'There should be only more than 1 library (singleBranchMode off)' ); |
| 144 |
|
| 145 |
$facets = C4::Koha::getFacets(); |
| 146 |
is( |
| 147 |
scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ), |
| 148 |
1, |
| 149 |
'location facet present with singleBranchMode off (bug 10078)' |
| 150 |
); |
| 151 |
}; |
| 152 |
|
| 120 |
1; |
153 |
1; |