Lines 24-30
use C4::Context;
Link Here
|
24 |
use Test::More; |
24 |
use Test::More; |
25 |
|
25 |
|
26 |
BEGIN { |
26 |
BEGIN { |
27 |
use_ok('Koha::Authority'); |
27 |
use_ok('Koha::MetadataRecord::Authority'); |
28 |
} |
28 |
} |
29 |
|
29 |
|
30 |
my $record = MARC::Record->new; |
30 |
my $record = MARC::Record->new; |
Lines 34-42
$record->add_fields(
Link Here
|
34 |
[ '150', ' ', ' ', a => 'Cooking' ], |
34 |
[ '150', ' ', ' ', a => 'Cooking' ], |
35 |
[ '450', ' ', ' ', a => 'Cookery' ], |
35 |
[ '450', ' ', ' ', a => 'Cookery' ], |
36 |
); |
36 |
); |
37 |
my $authority = Koha::Authority->new($record); |
37 |
my $authority = Koha::MetadataRecord::Authority->new($record); |
38 |
|
38 |
|
39 |
is(ref($authority), 'Koha::Authority', 'Created valid Koha::Authority object'); |
39 |
is(ref($authority), 'Koha::MetadataRecord::Authority', 'Created valid Koha::MetadataRecord::Authority object'); |
40 |
|
40 |
|
41 |
is($authority->authorized_heading(), 'Cooking', 'Authorized heading was correct'); |
41 |
is($authority->authorized_heading(), 'Cooking', 'Authorized heading was correct'); |
42 |
|
42 |
|
Lines 53-67
SKIP:
Link Here
|
53 |
$authid = $row->{'authid'}; |
53 |
$authid = $row->{'authid'}; |
54 |
} |
54 |
} |
55 |
skip 'No authorities', 3 unless $authid; |
55 |
skip 'No authorities', 3 unless $authid; |
56 |
$authority = Koha::Authority->get_from_authid($authid); |
56 |
$authority = Koha::MetadataRecord::Authority->get_from_authid($authid); |
57 |
|
57 |
|
58 |
is(ref($authority), 'Koha::Authority', 'Retrieved valid Koha::Authority object'); |
58 |
is(ref($authority), 'Koha::MetadataRecord::Authority', 'Retrieved valid Koha::MetadataRecord::Authority object'); |
59 |
|
59 |
|
60 |
is($authority->authid, $authid, 'Object authid is correct'); |
60 |
is($authority->authid, $authid, 'Object authid is correct'); |
61 |
|
61 |
|
62 |
is($authority->record->field('001')->data(), $authid, 'Retrieved correct record'); |
62 |
is($authority->record->field('001')->data(), $authid, 'Retrieved correct record'); |
63 |
|
63 |
|
64 |
$authority = Koha::Authority->get_from_authid('alphabetsoup'); |
64 |
$authority = Koha::MetadataRecord::Authority->get_from_authid('alphabetsoup'); |
65 |
is($authority, undef, 'No invalid record is retrieved'); |
65 |
is($authority, undef, 'No invalid record is retrieved'); |
66 |
} |
66 |
} |
67 |
|
67 |
|
Lines 77-91
SKIP:
Link Here
|
77 |
} |
77 |
} |
78 |
|
78 |
|
79 |
skip 'No authorities in reservoir', 3 unless $import_record_id; |
79 |
skip 'No authorities in reservoir', 3 unless $import_record_id; |
80 |
$authority = Koha::Authority->get_from_breeding($import_record_id); |
80 |
$authority = Koha::MetadataRecord::Authority->get_from_breeding($import_record_id); |
81 |
|
81 |
|
82 |
is(ref($authority), 'Koha::Authority', 'Retrieved valid Koha::Authority object'); |
82 |
is(ref($authority), 'Koha::MetadataRecord::Authority', 'Retrieved valid Koha::MetadataRecord::Authority object'); |
83 |
|
83 |
|
84 |
is($authority->authid, undef, 'Records in reservoir do not have an authid'); |
84 |
is($authority->authid, undef, 'Records in reservoir do not have an authid'); |
85 |
|
85 |
|
86 |
is(ref($authority->record), 'MARC::Record', 'MARC record attached to authority'); |
86 |
is(ref($authority->record), 'MARC::Record', 'MARC record attached to authority'); |
87 |
|
87 |
|
88 |
$authority = Koha::Authority->get_from_breeding('alphabetsoup'); |
88 |
$authority = Koha::MetadataRecord::Authority->get_from_breeding('alphabetsoup'); |
89 |
is($authority, undef, 'No invalid record is retrieved from reservoir'); |
89 |
is($authority, undef, 'No invalid record is retrieved from reservoir'); |
90 |
} |
90 |
} |
91 |
|
91 |
|