|
Lines 5-11
Link Here
|
| 5 |
|
5 |
|
| 6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
| 7 |
|
7 |
|
| 8 |
use Test::More tests => 9; |
8 |
use Test::More tests => 10; |
| 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 215-217
subtest 'AddAuthority should respect AUTO_INCREMENT (BZ 18104)' => sub {
Link Here
|
| 215 |
}; |
215 |
}; |
| 216 |
|
216 |
|
| 217 |
$schema->storage->txn_rollback; |
217 |
$schema->storage->txn_rollback; |
| 218 |
- |
218 |
|
|
|
219 |
$module->unmock('GetAuthority'); |
| 220 |
|
| 221 |
subtest 'ModAuthority() tests' => sub { |
| 222 |
|
| 223 |
plan tests => 2; |
| 224 |
|
| 225 |
$schema->storage->txn_begin; |
| 226 |
|
| 227 |
my $auth_type = 'GEOGR_NAME'; |
| 228 |
my $record = MARC::Record->new; |
| 229 |
$record->add_fields( |
| 230 |
[ '001', '1' ], |
| 231 |
[ '151', ' ', ' ', a => 'United States' ] |
| 232 |
); |
| 233 |
; |
| 234 |
my $auth_id = AddAuthority( $record, undef, $auth_type ); |
| 235 |
|
| 236 |
my $mocked_authorities_marc = Test::MockModule->new('C4::AuthoritiesMarc'); |
| 237 |
$mocked_authorities_marc->mock( 'merge', sub { warn 'merge called'; } ); |
| 238 |
|
| 239 |
warning_is |
| 240 |
{ ModAuthority( $auth_id, $record, $auth_type ); } |
| 241 |
'merge called', |
| 242 |
'No param, merge called'; |
| 243 |
|
| 244 |
warning_is |
| 245 |
{ ModAuthority( $auth_id, $record, $auth_type, { skip_merge => 1 } ); } |
| 246 |
undef, |
| 247 |
'skip_merge passed, merge not called'; |
| 248 |
|
| 249 |
$schema->storage->txn_rollback; |
| 250 |
}; |