|
Lines 5-11
Link Here
|
| 5 |
|
5 |
|
| 6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
| 7 |
|
7 |
|
| 8 |
use Test::More tests => 10; |
8 |
use Test::More tests => 11; |
| 9 |
use Test::MockModule; |
9 |
use Test::MockModule; |
| 10 |
use Test::Warn; |
10 |
use Test::Warn; |
| 11 |
use MARC::Record; |
11 |
use MARC::Record; |
|
Lines 248-250
subtest 'ModAuthority() tests' => sub {
Link Here
|
| 248 |
|
248 |
|
| 249 |
$schema->storage->txn_rollback; |
249 |
$schema->storage->txn_rollback; |
| 250 |
}; |
250 |
}; |
| 251 |
- |
251 |
|
|
|
252 |
subtest 'DelAuthority() tests' => sub { |
| 253 |
|
| 254 |
plan tests => 2; |
| 255 |
|
| 256 |
$schema->storage->txn_begin; |
| 257 |
|
| 258 |
my $auth_type = 'GEOGR_NAME'; |
| 259 |
my $record = MARC::Record->new; |
| 260 |
$record->add_fields( |
| 261 |
[ '001', '1' ], |
| 262 |
[ '151', ' ', ' ', a => 'United States' ] |
| 263 |
); |
| 264 |
; |
| 265 |
my $auth_id = AddAuthority( $record, undef, $auth_type ); |
| 266 |
|
| 267 |
my $mocked_authorities_marc = Test::MockModule->new('C4::AuthoritiesMarc'); |
| 268 |
$mocked_authorities_marc->mock( 'merge', sub { warn 'merge called'; } ); |
| 269 |
|
| 270 |
warning_is |
| 271 |
{ DelAuthority({ authid => $auth_id }); } |
| 272 |
'merge called', |
| 273 |
'No param, merge called'; |
| 274 |
|
| 275 |
$auth_id = AddAuthority( $record, undef, $auth_type ); |
| 276 |
|
| 277 |
warning_is |
| 278 |
{ DelAuthority({ authid => $auth_id, skip_merge => 1 }); } |
| 279 |
undef, |
| 280 |
'skip_merge passed, merge not called'; |
| 281 |
|
| 282 |
$schema->storage->txn_rollback; |
| 283 |
}; |