Bug 26425: Manual changes
[srvgit] / t / SocialData.t
old mode 100644 (file)
new mode 100755 (executable)
index 3d6cd1a..df14a50
@@ -1,21 +1,40 @@
 #!/usr/bin/perl
+
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-#Testing C4 SocialData
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
-use Test::More tests => 6;
+
+use Test::More;
 use Test::MockModule;
 
+use Module::Load::Conditional qw/check_install/;
+
+BEGIN {
+    if ( check_install( module => 'Test::DBIx::Class' ) ) {
+        plan tests => 6;
+    } else {
+        plan skip_all => "Need Test::DBIx::Class"
+    }
+}
+
 BEGIN {
     use_ok('C4::SocialData');
 }
 
-use Test::DBIx::Class {
-    schema_class => 'Koha::Schema',
-    connect_info => ['dbi:SQLite:dbname=:memory:','',''],
-    connect_opts => { name_sep => '.', quote_char => '`', },
-    fixture_class => '::Populate',
-}, 'SocialData', 'Biblioitem' ;
+use Test::DBIx::Class;
 
 fixtures_ok [
     Biblioitem => [
@@ -37,6 +56,7 @@ fixtures_ok [
 
 my $db = Test::MockModule->new('Koha::Database');
 $db->mock( _new_schema => sub { return Schema(); } );
+Koha::Database::flush_schema_cache();
 
 my $data = C4::SocialData::get_data();
 is( $data, undef, 'get_data should return undef if no param given');
@@ -51,3 +71,4 @@ is( $report->{'without'}->[0]->{'original'},
 
 is( $report->{'without'}->[0]->{'isbn'}, '9780596526740',
     'testing get_report' );
+