|
Lines 507-513
subtest 'suggestions() tests' => sub {
Link Here
|
| 507 |
$schema->storage->txn_rollback; |
507 |
$schema->storage->txn_rollback; |
| 508 |
}; |
508 |
}; |
| 509 |
|
509 |
|
| 510 |
subtest 'components() tests' => sub { |
510 |
subtest 'get_marc_components() tests' => sub { |
| 511 |
|
511 |
|
| 512 |
plan tests => 3; |
512 |
plan tests => 3; |
| 513 |
|
513 |
|
|
Lines 519-531
subtest 'components() tests' => sub {
Link Here
|
| 519 |
my $search_mod = Test::MockModule->new( 'Koha::SearchEngine::Zebra::Search' ); |
519 |
my $search_mod = Test::MockModule->new( 'Koha::SearchEngine::Zebra::Search' ); |
| 520 |
$search_mod->mock( 'simple_search_compat', \&search_component_record2 ); |
520 |
$search_mod->mock( 'simple_search_compat', \&search_component_record2 ); |
| 521 |
|
521 |
|
| 522 |
my @components = $host_biblio->components; |
522 |
my @components = $host_biblio->get_marc_components; |
| 523 |
is( ref(\@components), 'ARRAY', 'Return type is correct' ); |
523 |
is( ref(\@components), 'ARRAY', 'Return type is correct' ); |
| 524 |
|
524 |
|
| 525 |
is_deeply( |
525 |
is_deeply( |
| 526 |
[@components], |
526 |
[@components], |
| 527 |
[()], |
527 |
[()], |
| 528 |
'->components returns an empty ARRAY' |
528 |
'->get_marc_components returns an empty ARRAY' |
| 529 |
); |
529 |
); |
| 530 |
|
530 |
|
| 531 |
$search_mod->unmock( 'simple_search_compat'); |
531 |
$search_mod->unmock( 'simple_search_compat'); |
|
Lines 533-541
subtest 'components() tests' => sub {
Link Here
|
| 533 |
my $component_record = component_record1()->as_xml(); |
533 |
my $component_record = component_record1()->as_xml(); |
| 534 |
|
534 |
|
| 535 |
is_deeply( |
535 |
is_deeply( |
| 536 |
$host_biblio->components, |
536 |
$host_biblio->get_marc_components, |
| 537 |
[($component_record)], |
537 |
[($component_record)], |
| 538 |
'->components returns the related component part record' |
538 |
'->get_marc_components returns the related component part record' |
| 539 |
); |
539 |
); |
| 540 |
$search_mod->unmock( 'simple_search_compat'); |
540 |
$search_mod->unmock( 'simple_search_compat'); |
| 541 |
|
541 |
|
| 542 |
- |
|
|