From 251619575c423b4ac58505ee031533608322d160 Mon Sep 17 00:00:00 2001 From: Mason James Date: Wed, 20 Sep 2017 15:59:35 +1200 Subject: [PATCH] Revert "Bug 17249: Remove GetKohaAuthorisedValuesFromField - add tests" This reverts commit a53c3efd4c1773a609f2929a61b7324504cc18eb. --- t/db_dependent/Record/marcrecord2csv.t | 42 ++------------------------ 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/t/db_dependent/Record/marcrecord2csv.t b/t/db_dependent/Record/marcrecord2csv.t index e5cf0d374d..2ed797b6fd 100644 --- a/t/db_dependent/Record/marcrecord2csv.t +++ b/t/db_dependent/Record/marcrecord2csv.t @@ -1,7 +1,7 @@ #!/usr/bin/perl; use Modern::Perl; -use Test::More tests => 11; +use Test::More tests => 9; use Test::MockModule; use MARC::Record; use MARC::Field; @@ -11,18 +11,14 @@ use C4::Biblio qw( AddBiblio ); use C4::Context; use C4::Record; -use t::lib::TestBuilder; - my $dbh = C4::Context->dbh; $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; -my $builder = t::lib::TestBuilder->new; my $module_biblio = Test::MockModule->new('C4::Biblio'); my $record = new_record(); -my $frameworkcode = q||; -my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, $frameworkcode ); +my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, q|| ); $module_biblio->mock( 'GetMarcBiblio', sub{ $record } ); my $csv_content = q(Title=245$a|Author=245$c|Subject=650$a); @@ -92,35 +88,6 @@ is( $csv_output, q[Title ], q|TT way: display first subfield a for first field 245 if indicator 1 == 1 for field 100 is set| ); -my $authorised_value_1 = - $builder->build( { source => 'AuthorisedValue', value => { category => 'MY_AV_1', authorised_value => 1, lib => 'This is an AV', lib_opac => 'This is an AV (opac)' } } ); -my $authorised_value_2 = $builder->build( - { source => 'AuthorisedValue', value => { category => 'MY_AV_2', authorised_value => 2, lib => 'This is another AV', lib_opac => 'This is another AV (opac)' } } ); -$dbh->do(q|DELETE FROM marc_subfield_structure WHERE tagfield=998 and ( tagsubfield='8' or tagsubfield='9')|); -$builder->build( - { source => 'MarcSubfieldStructure', value => { authorised_value => $authorised_value_1->{category}, tagfield => 998, tagsubfield => '8', frameworkcode => $frameworkcode } } -); -$builder->build( - { source => 'MarcSubfieldStructure', value => { authorised_value => $authorised_value_2->{category}, tagfield => 998, tagsubfield => '9', frameworkcode => $frameworkcode } } -); -$csv_content = q(Title=245$a|AV1=998$8|AV2=998$9); -my $csv_profile_id_8 = insert_csv_profile( { csv_content => $csv_content } ); -$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_8, 1, $csv ); -is( $csv_output, q[Title|AV1|AV2 -"The art of computer programming,The art of another title"|"This is an AV"|"This is another AV" -], q|TT way: display first subfield a for first field 245 if indicator 1 == 1 for field 100 is set| -); - -$csv_content = q(Title=245$a|AVs=998); -my $csv_profile_id_9 = insert_csv_profile( { csv_content => $csv_content } ); -$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_9, 1, $csv ); -is( $csv_output, q[Title|AVs -"The art of computer programming,The art of another title"|"This is an AV,This is another AV" -], q|TT way: display first subfield a for first field 245 if indicator 1 == 1 for field 100 is set| -); - - - sub insert_csv_profile { my ( $params ) = @_; my $csv_content = $params->{csv_content}; @@ -172,11 +139,6 @@ sub new_record { c => 'GEN', d => '2001-06-25', ), - MARC::Field->new( - 998, ' ', ' ', - 8 => 1, - 9 => 2, - ), ); $record->append_fields(@fields); return $record; -- 2.39.5