Lines 5-11
Link Here
|
5 |
|
5 |
|
6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
7 |
|
7 |
|
8 |
use Test::More tests => 12; |
8 |
use Test::More tests => 13; |
9 |
use Test::MockModule; |
9 |
use Test::MockModule; |
10 |
use Test::Warn; |
10 |
use Test::Warn; |
11 |
use MARC::Field; |
11 |
use MARC::Field; |
Lines 175-180
$dbh->do(q{
Link Here
|
175 |
INSERT INTO auth_types (authtypecode, authtypetext, auth_tag_to_report, summary) |
175 |
INSERT INTO auth_types (authtypecode, authtypetext, auth_tag_to_report, summary) |
176 |
VALUES ('NP', 'Auteur', '200', '[200a][, 200b][ 200d][ ; 200c][ (200f)]') |
176 |
VALUES ('NP', 'Auteur', '200', '[200a][, 200b][ 200d][ ; 200c][ (200f)]') |
177 |
}); |
177 |
}); |
|
|
178 |
$dbh->do( |
179 |
q{ |
180 |
INSERT INTO marc_subfield_structure (frameworkcode,authtypecode,tagfield) |
181 |
VALUES ('','NP','200') |
182 |
} |
183 |
); |
178 |
|
184 |
|
179 |
my $unimarc_name_auth = MARC::Record->new(); |
185 |
my $unimarc_name_auth = MARC::Record->new(); |
180 |
$unimarc_name_auth->add_fields( |
186 |
$unimarc_name_auth->add_fields( |
Lines 212-228
subtest 'AddAuthority should respect AUTO_INCREMENT (BZ 18104)' => sub {
Link Here
|
212 |
plan tests => 3; |
218 |
plan tests => 3; |
213 |
|
219 |
|
214 |
t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' ); |
220 |
t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' ); |
215 |
my $record = C4::AuthoritiesMarc::GetAuthority(1); |
221 |
my $record = MARC::Record->new(); |
|
|
222 |
my $field = MARC::Field->new( '151', ' ', ' ', a => 'Amsterdam (Netherlands)', 'x' => 'Economic conditions' ); |
223 |
$record->append_fields($field); |
216 |
my $id1 = AddAuthority( $record, undef, 'GEOGR_NAME' ); |
224 |
my $id1 = AddAuthority( $record, undef, 'GEOGR_NAME' ); |
217 |
DelAuthority({ authid => $id1 }); |
225 |
DelAuthority( { authid => $id1 } ); |
|
|
226 |
$record = MARC::Record->new(); |
227 |
$record->append_fields($field); |
218 |
my $id2 = AddAuthority( $record, undef, 'GEOGR_NAME' ); |
228 |
my $id2 = AddAuthority( $record, undef, 'GEOGR_NAME' ); |
219 |
isnt( $id1, $id2, 'Do not return the same id again' ); |
229 |
isnt( $id1, $id2, 'Do not return the same id again' ); |
220 |
t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' ); |
230 |
t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' ); |
221 |
my $id3 = AddAuthority( $record, undef, 'GEOGR_NAME' ); |
231 |
$record = MARC::Record->new(); |
|
|
232 |
$field = MARC::Field->new( '200', ' ', ' ', a => 'Fossey', 'b' => 'Brigitte' ); |
233 |
$record->append_fields($field); |
234 |
my $id3 = AddAuthority( $record, undef, 'NP' ); |
222 |
ok( $id3 > 0, 'Tested AddAuthority with UNIMARC' ); |
235 |
ok( $id3 > 0, 'Tested AddAuthority with UNIMARC' ); |
223 |
is( $record->field('001')->data, $id3, 'Check updated 001' ); |
236 |
is( $record->field('001')->data, $id3, 'Check updated 001' ); |
224 |
}; |
237 |
}; |
225 |
|
238 |
|
|
|
239 |
subtest 'AddAuthority should create heading field with display form' => sub { |
240 |
plan tests => 2; |
241 |
|
242 |
t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' ); |
243 |
t::lib::Mocks::mock_preference( 'AuthoritiesLog', 0 ); |
244 |
my $record = MARC::Record->new(); |
245 |
my $field = MARC::Field->new( '151', ' ', ' ', a => 'White River Junction (Vt.)' ); |
246 |
$record->append_fields($field); |
247 |
my $id = AddAuthority( $record, undef, 'GEOGR_NAME' ); |
248 |
my $authority = Koha::Authorities->find($id); |
249 |
is( |
250 |
$authority->heading, 'White River Junction (Vt.)', |
251 |
'Heading field is formed as expected when adding authority' |
252 |
); |
253 |
$record = MARC::Record->new(); |
254 |
$field = MARC::Field->new( '151', ' ', ' ', a => 'Lyon (France)', 'x' => 'Antiquities' ); |
255 |
$record->append_fields($field); |
256 |
$id = ModAuthority( $id, $record, 'GEOGR_NAME' ); |
257 |
$authority = Koha::Authorities->find($id); |
258 |
is( |
259 |
$authority->heading, 'Lyon (France)--Antiquities', |
260 |
'Heading field is formed as expected when modding authority' |
261 |
); |
262 |
|
263 |
}; |
264 |
|
226 |
subtest 'CompareFieldWithAuthority tests' => sub { |
265 |
subtest 'CompareFieldWithAuthority tests' => sub { |
227 |
plan tests => 3; |
266 |
plan tests => 3; |
228 |
|
267 |
|
229 |
- |
|
|