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