|
Lines 310-316
subtest "as_marc_field() tests" => sub {
Link Here
|
| 310 |
my @schema_columns = $schema->resultset('Item')->result_source->columns; |
310 |
my @schema_columns = $schema->resultset('Item')->result_source->columns; |
| 311 |
my @mapped_columns = grep { exists $mss->{'items.'.$_} } @schema_columns; |
311 |
my @mapped_columns = grep { exists $mss->{'items.'.$_} } @schema_columns; |
| 312 |
|
312 |
|
| 313 |
plan tests => 2 * (scalar @mapped_columns + 1) + 3; |
313 |
plan tests => 2 * (scalar @mapped_columns + 1) + 4; |
| 314 |
|
314 |
|
| 315 |
$schema->storage->txn_begin; |
315 |
$schema->storage->txn_begin; |
| 316 |
|
316 |
|
|
Lines 355-363
subtest "as_marc_field() tests" => sub {
Link Here
|
| 355 |
tagsubfield => 'X', |
355 |
tagsubfield => 'X', |
| 356 |
} |
356 |
} |
| 357 |
)->store; |
357 |
)->store; |
|
|
358 |
Koha::MarcSubfieldStructure->new( |
| 359 |
{ |
| 360 |
frameworkcode => '', |
| 361 |
tagfield => $itemtag, |
| 362 |
tagsubfield => 'Y', |
| 363 |
kohafield => '', |
| 364 |
} |
| 365 |
)->store; |
| 358 |
|
366 |
|
| 359 |
my @unlinked_subfields; |
367 |
my @unlinked_subfields; |
| 360 |
push @unlinked_subfields, X => 'Something weird'; |
368 |
push @unlinked_subfields, X => 'Something weird', Y => 'Something else'; |
| 361 |
$item->more_subfields_xml( C4::Items::_get_unlinked_subfields_xml( \@unlinked_subfields ) )->store; |
369 |
$item->more_subfields_xml( C4::Items::_get_unlinked_subfields_xml( \@unlinked_subfields ) )->store; |
| 362 |
|
370 |
|
| 363 |
Koha::Caches->get_instance->clear_from_cache( "MarcStructure-1-" ); |
371 |
Koha::Caches->get_instance->clear_from_cache( "MarcStructure-1-" ); |
|
Lines 377-383
subtest "as_marc_field() tests" => sub {
Link Here
|
| 377 |
} @subfields; |
385 |
} @subfields; |
| 378 |
is_deeply(\@subfields, \@ordered_subfields); |
386 |
is_deeply(\@subfields, \@ordered_subfields); |
| 379 |
|
387 |
|
| 380 |
is( scalar $marc_field->subfield('X'), 'Something weird', 'more_subfield_xml is considered' ); |
388 |
is( scalar $marc_field->subfield('X'), 'Something weird', 'more_subfield_xml is considered when kohafield is NULL' ); |
|
|
389 |
is( scalar $marc_field->subfield('Y'), 'Something else', 'more_subfield_xml is considered when kohafield = ""' ); |
| 381 |
|
390 |
|
| 382 |
$schema->storage->txn_rollback; |
391 |
$schema->storage->txn_rollback; |
| 383 |
Koha::Caches->get_instance->clear_from_cache( "MarcStructure-1-" ); |
392 |
Koha::Caches->get_instance->clear_from_cache( "MarcStructure-1-" ); |
| 384 |
- |
|
|