Bug 12357: [QA Followup] - Unit Test
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 28 Apr 2015 12:56:49 +0000 (08:56 -0400)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 7 Sep 2015 16:58:49 +0000 (13:58 -0300)
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
This works with next patch

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
t/db_dependent/Record.t

index e8d6094..5dfa36a 100755 (executable)
@@ -1,18 +1,22 @@
 #!/usr/bin/perl
-#
-# This Koha test module is a stub!  
-# Add more tests here!!!
 
 use Modern::Perl;
 
-use Test::More tests => 11;
+use Test::More tests => 12;
 use MARC::Record;
 
+use C4::Context;
+
 BEGIN {
         use_ok('C4::Record');
 }
 
-#my ($marc,$to_flavour,$from_flavour,$encoding) = @_;
+my $dbh = C4::Context->dbh;
+# Start transaction
+$dbh->{AutoCommit} = 0;
+$dbh->{RaiseError} = 1;
+
+C4::Context->set_preference( "BibtexExportAdditionalFields", q{} );
 
 my @marcarray=marc2marc;
 is ($marcarray[0],"Feature not yet implemented\n","error works");
@@ -106,6 +110,19 @@ my $test5xml=qq(\@book{testID,
 
 is ($bibtex, $test5xml, "testing bibtex");
 
+C4::Context->set_preference( "BibtexExportAdditionalFields", "'\@': 260\$b\ntest: 260\$b" );
+$bibtex = marc2bibtex( $marc, 'testID' );
+my $test6xml = qq(\@Scholastic{testID,
+       author = {Rowling, J.K.},
+       title = {Harry potter},
+       publisher = {Scholastic},
+       year = {2001},
+       test = {Scholastic}
+}
+);
+is( $bibtex, $test6xml, "testing bibtex" );
+C4::Context->set_preference( "BibtexExportAdditionalFields", q{} );
+
 $marc->append_fields(MARC::Field->new(
     '264', '3', '1', b => 'Reprints', c => '2011'
 ));