| Lines 22-33
          use Test::Exception;
      
      
        Link Here | 
        
          | 22 | use Test::Warn; | 22 | use Test::Warn; | 
        
          | 23 | use t::lib::Mocks; | 23 | use t::lib::Mocks; | 
        
          | 24 | use t::lib::TestBuilder; | 24 | use t::lib::TestBuilder; | 
          
            
              | 25 | use Test::More tests => 7; | 25 | use Test::More tests => 8; | 
        
          | 26 |  | 26 |  | 
        
          | 27 | use List::Util qw( all ); | 27 | use List::Util qw( all ); | 
        
          | 28 |  | 28 |  | 
        
          | 29 | use Koha::Database; | 29 | use Koha::Database; | 
        
          | 30 | use Koha::SearchEngine::Elasticsearch::QueryBuilder; | 30 | use Koha::SearchEngine::Elasticsearch::QueryBuilder; | 
            
              |  |  | 31 | use Koha::SearchFilters; | 
        
          | 31 |  | 32 |  | 
        
          | 32 | my $schema = Koha::Database->new->schema; | 33 | my $schema = Koha::Database->new->schema; | 
        
          | 33 | $schema->storage->txn_begin; | 34 | $schema->storage->txn_begin; | 
  
    | Lines 758-763
          subtest 'build_query_compat() SearchLimitLibrary tests' => sub {
      
      
        Link Here | 
        
          | 758 |  | 759 |  | 
        
          | 759 | }; | 760 | }; | 
        
          | 760 |  | 761 |  | 
            
              |  |  | 762 | subtest "Handle search filters" => sub { | 
            
              | 763 |     plan tests => 4; | 
            
              | 764 |  | 
            
              | 765 |     my $qb; | 
            
              | 766 |  | 
            
              | 767 |     ok( | 
            
              | 768 |         $qb = Koha::SearchEngine::Elasticsearch::QueryBuilder->new({ 'index' => 'biblios' }), | 
            
              | 769 |         'Creating new query builder object for biblios' | 
            
              | 770 |     ); | 
            
              | 771 |  | 
            
              | 772 |     my $filter = Koha::SearchFilter->new({ | 
            
              | 773 |         name => "test", | 
            
              | 774 |         query => q|{"operands":["cat","bat","rat"],"indexes":["kw","ti","au"],"operators":["AND","OR"]}|, | 
            
              | 775 |         limits => q|{"limits":["mc-itype,phr:BK","available"]}|, | 
            
              | 776 |     })->store; | 
            
              | 777 |     my $filter_id = $filter->id; | 
            
              | 778 |  | 
            
              | 779 |     my ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc ) = $qb->build_query_compat( undef, undef, undef, ["search_filter:$filter_id"] ); | 
            
              | 780 |  | 
            
              | 781 |     is( $limit,q{(itype:("BK")) AND (onloan:false) AND (((cat) AND title:(bat) OR author:(rat)))},"Limit correctly formed"); | 
            
              | 782 |     is( $limit_cgi,"&limit=search_filter%3A$filter_id","CGI limit is not expanded"); | 
            
              | 783 |     is( $limit_desc,q{(itype:("BK")) AND (onloan:false) AND (((cat) AND title:(bat) OR author:(rat)))},"Limit description is correctly expanded"); | 
            
              | 784 |  | 
            
              | 785 | }; | 
            
              | 786 |  | 
        
          | 761 | subtest "_convert_sort_fields() tests" => sub { | 787 | subtest "_convert_sort_fields() tests" => sub { | 
        
          | 762 |     plan tests => 3; | 788 |     plan tests => 3; | 
        
          | 763 |  | 789 |  |