| 
      
            Lines 4-10
          
      
      
        Link Here
      
     | 
  
        
          | 4 | 
          # Current state is very rudimentary. Please help to extend it!  | 
          4 | 
          # Current state is very rudimentary. Please help to extend it!  | 
        
        
          | 5 | 
           | 
          5 | 
           | 
        
        
          | 6 | 
          use Modern::Perl;  | 
          6 | 
          use Modern::Perl;  | 
        
          
            
              | 7 | 
              use Test::More tests => 7;  | 
              7 | 
              use Test::More tests => 8;  | 
            
        
          | 8 | 
           | 
          8 | 
           | 
        
        
          | 9 | 
          use Koha::Database;  | 
          9 | 
          use Koha::Database;  | 
        
        
          | 10 | 
          use t::lib::TestBuilder;  | 
          10 | 
          use t::lib::TestBuilder;  | 
        
  
    | 
      
            Lines 14-22
          use C4::SIP::ILS::Transaction::RenewAll;
      
      
        Link Here
      
     | 
  
        
          | 14 | 
          use C4::SIP::ILS::Transaction::Checkout;  | 
          14 | 
          use C4::SIP::ILS::Transaction::Checkout;  | 
        
        
          | 15 | 
          use C4::SIP::ILS::Transaction::FeePayment;  | 
          15 | 
          use C4::SIP::ILS::Transaction::FeePayment;  | 
        
        
          | 16 | 
          use C4::SIP::ILS::Transaction::Hold;  | 
          16 | 
          use C4::SIP::ILS::Transaction::Hold;  | 
        
            
               | 
               | 
              17 | 
              use C4::SIP::ILS::Transaction::Checkout;  | 
            
            
              | 18 | 
              use C4::SIP::ILS::Transaction::Checkin;  | 
            
        
          | 17 | 
           | 
          19 | 
           | 
        
        
          | 18 | 
          use C4::Reserves;  | 
          20 | 
          use C4::Reserves;  | 
        
        
          | 19 | 
          use Koha::CirculationRules;  | 
          21 | 
          use Koha::CirculationRules;  | 
        
            
               | 
               | 
              22 | 
              use Koha::DateUtils qw( dt_from_string output_pref );  | 
            
        
          | 20 | 
           | 
          23 | 
           | 
        
        
          | 21 | 
          my $schema = Koha::Database->new->schema;  | 
          24 | 
          my $schema = Koha::Database->new->schema;  | 
        
        
          | 22 | 
          $schema->storage->txn_begin;  | 
          25 | 
          $schema->storage->txn_begin;  | 
        
  
    | 
      
            Lines 269-272
          subtest do_hold => sub {
      
      
        Link Here
      
     | 
  
        
          | 269 | 
              is( $patron_2->holds->next->priority, 2, 'Hold placed from SIP should have a correct priority of 2');  | 
          272 | 
              is( $patron_2->holds->next->priority, 2, 'Hold placed from SIP should have a correct priority of 2');  | 
        
        
          | 270 | 
          };  | 
          273 | 
          };  | 
        
        
          | 271 | 
           | 
          274 | 
           | 
        
            
               | 
               | 
              275 | 
              subtest do_checkin => sub { | 
            
            
              | 276 | 
                  plan tests => 8;  | 
            
            
              | 277 | 
               | 
            
            
              | 278 | 
                  my $library = $builder->build_object( { class => 'Koha::Libraries' } ); | 
            
            
              | 279 | 
                  my $patron = $builder->build_object(  | 
            
            
              | 280 | 
                      { | 
            
            
              | 281 | 
                          class => 'Koha::Patrons',  | 
            
            
              | 282 | 
                          value => { | 
            
            
              | 283 | 
                              branchcode => $library->branchcode,  | 
            
            
              | 284 | 
                          }  | 
            
            
              | 285 | 
                      }  | 
            
            
              | 286 | 
                  );  | 
            
            
              | 287 | 
               | 
            
            
              | 288 | 
                  t::lib::Mocks::mock_userenv(  | 
            
            
              | 289 | 
                      { branchcode => $library->branchcode, flags => 1 } ); | 
            
            
              | 290 | 
               | 
            
            
              | 291 | 
                  my $item = $builder->build_sample_item(  | 
            
            
              | 292 | 
                      { | 
            
            
              | 293 | 
                          library => $library->branchcode,  | 
            
            
              | 294 | 
                      }  | 
            
            
              | 295 | 
                  );  | 
            
            
              | 296 | 
               | 
            
            
              | 297 | 
               | 
            
            
              | 298 | 
                  # Checkout  | 
            
            
              | 299 | 
                  my $sip_patron  = C4::SIP::ILS::Patron->new( $patron->cardnumber );  | 
            
            
              | 300 | 
                  my $sip_item    = C4::SIP::ILS::Item->new( $item->barcode );  | 
            
            
              | 301 | 
                  my $co_transaction = C4::SIP::ILS::Transaction::Checkout->new();  | 
            
            
              | 302 | 
                  is( $co_transaction->patron($sip_patron),  | 
            
            
              | 303 | 
                      $sip_patron, "Patron assigned to transaction" );  | 
            
            
              | 304 | 
                  is( $co_transaction->item($sip_item),  | 
            
            
              | 305 | 
                      $sip_item, "Item assigned to transaction" );  | 
            
            
              | 306 | 
                  my $checkout = $co_transaction->do_checkout();  | 
            
            
              | 307 | 
                  is( $patron->checkouts->count, 1, 'Checkout should have been done successfully');  | 
            
            
              | 308 | 
               | 
            
            
              | 309 | 
                  # Checkin  | 
            
            
              | 310 | 
                  my $ci_transaction = C4::SIP::ILS::Transaction::Checkin->new();  | 
            
            
              | 311 | 
                  is( $ci_transaction->patron($sip_patron),  | 
            
            
              | 312 | 
                      $sip_patron, "Patron assigned to transaction" );  | 
            
            
              | 313 | 
                  is( $ci_transaction->item($sip_item),  | 
            
            
              | 314 | 
                      $sip_item, "Item assigned to transaction" );  | 
            
            
              | 315 | 
               | 
            
            
              | 316 | 
                  my $checkin = $ci_transaction->do_checkin($library->branchcode, C4::SIP::Sip::timestamp);  | 
            
            
              | 317 | 
                  is( $patron->checkouts->count, 0, 'Checkin should have been done successfully');  | 
            
            
              | 318 | 
               | 
            
            
              | 319 | 
                  # Test checkin without return date  | 
            
            
              | 320 | 
                  $co_transaction->do_checkout;  | 
            
            
              | 321 | 
                  is( $patron->checkouts->count, 1, 'Checkout should have been done successfully');  | 
            
            
              | 322 | 
                  $ci_transaction->do_checkin($library->branchcode, undef);  | 
            
            
              | 323 | 
                  is( $patron->checkouts->count, 0, 'Checkin should have been done successfully');  | 
            
            
              | 324 | 
              };  | 
            
            
              | 325 | 
               | 
            
        
          | 272 | 
          $schema->storage->txn_rollback;  | 
          326 | 
          $schema->storage->txn_rollback;  | 
        
            
              | 273 | 
              -   | 
               | 
               |