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 => 34; |
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', 'Branch' ; |
41 |
}, 'Branch' ; |
42 |
|
42 |
|
43 |
sub fixtures { |
43 |
sub fixtures { |
44 |
my ( $av, $libraries ) = @_; |
44 |
my ( $libraries ) = @_; |
45 |
fixtures_ok [ |
45 |
fixtures_ok [ |
46 |
AuthorisedValue => [ |
|
|
47 |
[ 'category', 'authorised_value' ], |
48 |
@$av, |
49 |
], |
50 |
Branch => [ |
46 |
Branch => [ |
51 |
['branchcode', 'branchname'], |
47 |
['branchcode', 'branchname'], |
52 |
@$libraries, |
48 |
@$libraries, |
Lines 57-74
sub fixtures {
Link Here
|
57 |
my $db = Test::MockModule->new('Koha::Database'); |
53 |
my $db = Test::MockModule->new('Koha::Database'); |
58 |
$db->mock( _new_schema => sub { return Schema(); } ); |
54 |
$db->mock( _new_schema => sub { return Schema(); } ); |
59 |
|
55 |
|
60 |
my $authorised_values = [ |
|
|
61 |
['LOC', 'LOC'], |
62 |
['RELTERMS', 'RELTERMS'], |
63 |
]; |
64 |
my $libraries = [ |
56 |
my $libraries = [ |
65 |
['XXX_test', 'my branchname XXX'], |
57 |
['XXX_test', 'my branchname XXX'], |
66 |
]; |
58 |
]; |
67 |
fixtures($authorised_values, $libraries); |
59 |
fixtures($libraries); |
68 |
|
|
|
69 |
is ( IsAuthorisedValueCategory('LOC'), 1, 'LOC is a valid authorized value category'); |
70 |
is ( IsAuthorisedValueCategory('something'), 0, 'something is not a valid authorized value category'); |
71 |
is ( IsAuthorisedValueCategory('RELTERMS'), 1, 'RELTERMS is a valid authorized value category'); |
72 |
|
60 |
|
73 |
my $isbn13 = "9780330356473"; |
61 |
my $isbn13 = "9780330356473"; |
74 |
my $isbn13D = "978-0-330-35647-3"; |
62 |
my $isbn13D = "978-0-330-35647-3"; |
Lines 139-145
subtest 'getFacets() tests' => sub {
Link Here
|
139 |
['YYY_test', 'my branchname YYY'], |
127 |
['YYY_test', 'my branchname YYY'], |
140 |
['ZZZ_test', 'my branchname XXX'], |
128 |
['ZZZ_test', 'my branchname XXX'], |
141 |
]; |
129 |
]; |
142 |
fixtures($authorised_values, $libraries); |
130 |
fixtures($libraries); |
143 |
is ( Koha::Libraries->search->count, 3, 'There should be only more than 1 library (singleBranchMode off)' ); |
131 |
is ( Koha::Libraries->search->count, 3, 'There should be only more than 1 library (singleBranchMode off)' ); |
144 |
|
132 |
|
145 |
$facets = C4::Koha::getFacets(); |
133 |
$facets = C4::Koha::getFacets(); |