|
Lines 22-27
use Test::More tests => 14;
Link Here
|
| 22 |
use C4::Biblio qw( AddBiblio ModBiblio ); |
22 |
use C4::Biblio qw( AddBiblio ModBiblio ); |
| 23 |
use Koha::Database; |
23 |
use Koha::Database; |
| 24 |
use Koha::Acquisition::Orders; |
24 |
use Koha::Acquisition::Orders; |
|
|
25 |
use Koha::AuthorisedValueCategories; |
| 26 |
use Koha::AuthorisedValues; |
| 27 |
use Koha::MarcSubfieldStructures; |
| 25 |
|
28 |
|
| 26 |
use t::lib::TestBuilder; |
29 |
use t::lib::TestBuilder; |
| 27 |
use t::lib::Mocks; |
30 |
use t::lib::Mocks; |
|
Lines 580-586
subtest 'subscriptions() tests' => sub {
Link Here
|
| 580 |
}; |
583 |
}; |
| 581 |
|
584 |
|
| 582 |
subtest 'get_marc_notes() MARC21 tests' => sub { |
585 |
subtest 'get_marc_notes() MARC21 tests' => sub { |
| 583 |
plan tests => 11; |
586 |
plan tests => 13; |
| 584 |
|
587 |
|
| 585 |
$schema->storage->txn_begin; |
588 |
$schema->storage->txn_begin; |
| 586 |
|
589 |
|
|
Lines 594-615
subtest 'get_marc_notes() MARC21 tests' => sub {
Link Here
|
| 594 |
MARC::Field->new( '520', '', '', a => 'Note3 skipped' ), |
597 |
MARC::Field->new( '520', '', '', a => 'Note3 skipped' ), |
| 595 |
MARC::Field->new( '541', '0', '', a => 'Note4 skipped on opac' ), |
598 |
MARC::Field->new( '541', '0', '', a => 'Note4 skipped on opac' ), |
| 596 |
MARC::Field->new( '541', '', '', a => 'Note5' ), |
599 |
MARC::Field->new( '541', '', '', a => 'Note5' ), |
|
|
600 |
MARC::Field->new( '590', '', '', a => 'CODE' ), |
| 597 |
); |
601 |
); |
|
|
602 |
|
| 603 |
Koha::AuthorisedValueCategory->new({ category_name => 'TEST' })->store; |
| 604 |
Koha::AuthorisedValue->new({ category => 'TEST', authorised_value => 'CODE', lib => 'Description should show', lib_opac => 'Description should show OPAC' })->store; |
| 605 |
my $mss = Koha::MarcSubfieldStructures->find({tagfield => "590", tagsubfield => "a", frameworkcode => $biblio->frameworkcode }); |
| 606 |
$mss->update({ authorised_value => "TEST" }); |
| 607 |
|
| 598 |
C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); |
608 |
C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); |
| 599 |
$biblio = Koha::Biblios->find( $biblio->biblionumber); |
609 |
$biblio = Koha::Biblios->find( $biblio->biblionumber); |
|
|
610 |
|
| 600 |
my $notes = $biblio->get_marc_notes({ marcflavour => 'MARC21' }); |
611 |
my $notes = $biblio->get_marc_notes({ marcflavour => 'MARC21' }); |
| 601 |
is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); |
612 |
is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); |
| 602 |
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); |
613 |
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); |
| 603 |
is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' ); |
614 |
is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' ); |
| 604 |
is( $notes->[3]->{marcnote}, 'Note4 skipped on opac',"Not shows if not opac" ); |
615 |
is( $notes->[3]->{marcnote}, 'Note4 skipped on opac',"Not shows if not opac" ); |
| 605 |
is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' ); |
616 |
is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' ); |
| 606 |
is( @$notes, 5, 'No more notes' ); |
617 |
is( $notes->[5]->{marcnote}, 'Description should show', 'Authorised value is correctly parsed to show description rather than code' ); |
|
|
618 |
is( @$notes, 6, 'No more notes' ); |
| 607 |
$notes = $biblio->get_marc_notes({ marcflavour => 'MARC21', opac => 1 }); |
619 |
$notes = $biblio->get_marc_notes({ marcflavour => 'MARC21', opac => 1 }); |
| 608 |
is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); |
620 |
is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); |
| 609 |
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); |
621 |
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); |
| 610 |
is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' ); |
622 |
is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' ); |
| 611 |
is( $notes->[3]->{marcnote}, 'Note5', 'Fifth note shows after fourth skipped' ); |
623 |
is( $notes->[3]->{marcnote}, 'Note5', 'Fifth note shows after fourth skipped' ); |
| 612 |
is( @$notes, 4, 'No more notes' ); |
624 |
is( $notes->[4]->{marcnote}, 'Description should show OPAC', 'Authorised value is correctly parsed for OPAC to show description rather than code' ); |
|
|
625 |
is( @$notes, 5, 'No more notes' ); |
| 613 |
|
626 |
|
| 614 |
$schema->storage->txn_rollback; |
627 |
$schema->storage->txn_rollback; |
| 615 |
}; |
628 |
}; |
| 616 |
- |
|
|