| 
      
            Lines 33-39
          use Koha::Caches;
      
      
        Link Here
      
     | 
  
        
          | 33 | 
          use t::lib::Mocks;  | 
          33 | 
          use t::lib::Mocks;  | 
        
        
          | 34 | 
          use t::lib::TestBuilder;  | 
          34 | 
          use t::lib::TestBuilder;  | 
        
        
          | 35 | 
           | 
          35 | 
           | 
        
          
            
              | 36 | 
              use Test::More tests => 14;  | 
              36 | 
              use Test::More tests => 15;  | 
            
        
          | 37 | 
           | 
          37 | 
           | 
        
        
          | 38 | 
          use Test::Warn;  | 
          38 | 
          use Test::Warn;  | 
        
        
          | 39 | 
           | 
          39 | 
           | 
        
  
    | 
      
            Lines 934-939
          subtest 'Check add_to_rota method' => sub {
      
      
        Link Here
      
     | 
  
        
          | 934 | 
              $schema->storage->txn_rollback;  | 
          934 | 
              $schema->storage->txn_rollback;  | 
        
        
          | 935 | 
          };  | 
          935 | 
          };  | 
        
        
          | 936 | 
           | 
          936 | 
           | 
        
            
               | 
               | 
              937 | 
              subtest 'Split subfields in Item2Marc (Bug 21774)' => sub { | 
            
            
              | 938 | 
                  plan tests => 3;  | 
            
            
              | 939 | 
                  $schema->storage->txn_begin;  | 
            
            
              | 940 | 
               | 
            
            
              | 941 | 
                  my $builder = t::lib::TestBuilder->new;  | 
            
            
              | 942 | 
                  my $biblio = $builder->build({ source => 'Biblio', value => { frameworkcode => q{} } }); | 
            
            
              | 943 | 
                  my $item = $builder->build({ source => 'Item', value => { biblionumber => $biblio->{biblionumber}, ccode => 'A|B' } }); | 
            
            
              | 944 | 
               | 
            
            
              | 945 | 
                  Koha::MarcSubfieldStructures->search({ tagfield => '952', tagsubfield => '8' })->delete; # theoretical precaution | 
            
            
              | 946 | 
                  Koha::MarcSubfieldStructures->search({ kohafield => 'items.ccode' })->delete; | 
            
            
              | 947 | 
                  my $mapping = Koha::MarcSubfieldStructure->new({ frameworkcode => q{}, tagfield => '952', tagsubfield => '8', kohafield => 'items.ccode' })->store; | 
            
            
              | 948 | 
               | 
            
            
              | 949 | 
                  # Start testing  | 
            
            
              | 950 | 
                  my $marc = C4::Items::Item2Marc( $item, $biblio->{biblionumber} ); | 
            
            
              | 951 | 
                  my @subs = $marc->subfield( $mapping->tagfield, $mapping->tagsubfield );  | 
            
            
              | 952 | 
                  is( @subs, 2, 'Expect two subfields' );  | 
            
            
              | 953 | 
                  is( $subs[0], 'A', 'First subfield matches' );  | 
            
            
              | 954 | 
                  is( $subs[1], 'B', 'Second subfield matches' );  | 
            
            
              | 955 | 
               | 
            
            
              | 956 | 
                  $schema->storage->txn_rollback;  | 
            
            
              | 957 | 
              };  | 
            
            
              | 958 | 
               | 
            
        
          | 937 | 
          # Helper method to set up a Biblio.  | 
          959 | 
          # Helper method to set up a Biblio.  | 
        
        
          | 938 | 
          sub get_biblio { | 
          960 | 
          sub get_biblio { | 
        
        
          | 939 | 
              my ( $frameworkcode ) = @_;  | 
          961 | 
              my ( $frameworkcode ) = @_;  | 
        
            
              | 940 | 
              -   | 
               | 
               |