Bug 6752: Be stricter with utf-8 encoding of output
[koha_fer] / t / db_dependent / lib / KohaTest.pm
index 1282e38..d8cf495 100644 (file)
@@ -201,8 +201,6 @@ sub startup_15_truncate_tables : Test( startup => 1 ) {
                               ethnicity
                               issues
                               issuingrules
-                              labels
-                              labels_profile
                               matchchecks
                               notifys
                               nozebra
@@ -268,8 +266,6 @@ we need a bookfund for many of the tests. This currently uses one that
 is in the skeleton database.  free to use this one, or insert your
 own.
 
-=cut
-
 sub startup_22_add_bookfund : Test(startup => 2) {
     my $self = shift;
 
@@ -283,6 +279,8 @@ sub startup_22_add_bookfund : Test(startup => 2) {
     return;
 }
 
+=cut
+
 =head2 startup_24_add_branch
 
 =cut
@@ -590,8 +588,8 @@ sub add_biblios {
 
     $self->reindex_marc();
     my $query = 'Finn Test';
-    my ( $error, $results ) = SimpleSearch( $query );
-    if ( $param{'count'} <= scalar( @$results ) ) {
+    my ( $error, $results, undef ) = SimpleSearch( $query );
+    if ( !defined $error && $param{'count'} <=  @{$results} ) {
         pass( "found all $param{'count'} titles" );
     } else {
         fail( "we never found all $param{'count'} titles" );
@@ -627,11 +625,11 @@ sub reindex_marc {
         mkdir "$directory/$record_type";
         my $sth = $dbh->prepare($record_type eq "biblio" ? "SELECT marc FROM biblioitems" : "SELECT marc FROM auth_header");
         $sth->execute();
-        open OUT, ">:utf8", "$directory/$record_type/records";
+        open my $out, '>:encoding(UTF-8)', "$directory/$record_type/records";
         while (my ($blob) = $sth->fetchrow_array) {
-            print OUT $blob;
+            print {$out} $blob;
         }
-        close OUT;
+        close $out;
         my $zebra_server = "${record_type}server";
         my $zebra_config  = C4::Context->zebraconfig($zebra_server)->{'config'};
         my $zebra_db_dir  = C4::Context->zebraconfig($zebra_server)->{'directory'};