Bug 18925: (RM follow-up) Remove maxissueqty from issuingrule in SIP tests
[koha.git] / t / SuggestionEngine_AuthorityFile.t
index ef6eb42..eab5fb6 100755 (executable)
@@ -28,8 +28,20 @@ use Test::More;
 use Test::MockModule;
 use t::lib::Mocks;
 
-# Mock the DB connexion and C4::Context
-my $context = t::lib::Mocks::mock_dbh;
+use Module::Load::Conditional qw/check_install/;
+
+BEGIN {
+    if ( check_install( module => 'Test::DBIx::Class' ) ) {
+        plan tests => 3;
+    } else {
+        plan skip_all => "Need Test::DBIx::Class"
+    }
+}
+
+# Mock the DB connexion
+use Test::DBIx::Class;
+my $db = Test::MockModule->new('Koha::Database');
+$db->mock( _new_schema => sub { return Schema(); } );
 
 use_ok('Koha::SuggestionEngine');
 
@@ -55,8 +67,7 @@ is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine');
 
 my $result = $suggestor->get_suggestions({search => 'Cookery'});
 
-is_deeply($result, [ { 'search' => 'an=1234', 'relevance' => 1, 'label' => 'Cooking' } ], "Suggested correct alternative to 'Cookery'");
+is_deeply($result, [ { 'search' => 'an:1234', 'relevance' => 1, 'label' => 'Cooking' } ], "Suggested correct alternative to 'Cookery'");
 
 done_testing();
 
-1;