| Lines 19-25
          
      
      
        Link Here | 
        
          | 19 |  | 19 |  | 
        
          | 20 | use Modern::Perl; | 20 | use Modern::Perl; | 
        
          | 21 |  | 21 |  | 
          
            
              | 22 | use Test::More tests => 7; | 22 | use Test::More tests => 8; | 
        
          | 23 | use Test::Warn; | 23 | use Test::Warn; | 
        
          | 24 |  | 24 |  | 
        
          | 25 | use Koha::Authority::Types; | 25 | use Koha::Authority::Types; | 
  
    | Lines 29-36
          use Koha::Database;
      
      
        Link Here | 
        
          | 29 |  | 29 |  | 
        
          | 30 | use t::lib::TestBuilder; | 30 | use t::lib::TestBuilder; | 
        
          | 31 |  | 31 |  | 
            
              |  |  | 32 | use Try::Tiny; | 
            
              | 33 |  | 
        
          | 32 | my $schema = Koha::Database->new->schema; | 34 | my $schema = Koha::Database->new->schema; | 
        
          | 33 | $schema->storage->txn_begin; | 35 | $schema->storage->txn_begin; | 
            
              |  |  | 36 | my $builder = t::lib::TestBuilder->new; | 
        
          | 34 |  | 37 |  | 
        
          | 35 | is( ref(Koha::Authority::Types->find('')), 'Koha::Authority::Type', 'Koha::Objects->find should work if the primary key is an empty string' ); | 38 | is( ref(Koha::Authority::Types->find('')), 'Koha::Authority::Type', 'Koha::Objects->find should work if the primary key is an empty string' ); | 
        
          | 36 |  | 39 |  | 
  
    | Lines 40-46
          is( $borrowernumber_exists, 1, 'Koha::Objects->columns should return the table c
      
      
        Link Here | 
        
          | 40 |  | 43 |  | 
        
          | 41 | subtest 'update' => sub { | 44 | subtest 'update' => sub { | 
        
          | 42 |     plan tests => 2; | 45 |     plan tests => 2; | 
          
            
              | 43 |     my $builder = t::lib::TestBuilder->new; | 46 |  | 
        
          | 44 |     $builder->build( { source => 'City', value => { city_country => 'UK' } } ); | 47 |     $builder->build( { source => 'City', value => { city_country => 'UK' } } ); | 
        
          | 45 |     $builder->build( { source => 'City', value => { city_country => 'UK' } } ); | 48 |     $builder->build( { source => 'City', value => { city_country => 'UK' } } ); | 
        
          | 46 |     $builder->build( { source => 'City', value => { city_country => 'UK' } } ); | 49 |     $builder->build( { source => 'City', value => { city_country => 'UK' } } ); | 
  
    | Lines 60-66
          subtest 'pager' => sub {
      
      
        Link Here | 
        
          | 60 |  | 63 |  | 
        
          | 61 | subtest 'reset' => sub { | 64 | subtest 'reset' => sub { | 
        
          | 62 |     plan tests => 1; | 65 |     plan tests => 1; | 
          
            
              | 63 |     my $builder   = t::lib::TestBuilder->new; | 66 |  | 
        
          | 64 |     my $patrons = Koha::Patrons->search; | 67 |     my $patrons = Koha::Patrons->search; | 
        
          | 65 |     my $first_borrowernumber = $patrons->next->borrowernumber; | 68 |     my $first_borrowernumber = $patrons->next->borrowernumber; | 
        
          | 66 |     my $second_borrowernumber = $patrons->next->borrowernumber; | 69 |     my $second_borrowernumber = $patrons->next->borrowernumber; | 
  
    | Lines 69-75
          subtest 'reset' => sub {
      
      
        Link Here | 
        
          | 69 |  | 72 |  | 
        
          | 70 | subtest 'delete' => sub { | 73 | subtest 'delete' => sub { | 
        
          | 71 |     plan tests => 2; | 74 |     plan tests => 2; | 
          
            
              | 72 |     my $builder   = t::lib::TestBuilder->new; | 75 |  | 
        
          | 73 |     my $patron_1 = $builder->build({source => 'Borrower'}); | 76 |     my $patron_1 = $builder->build({source => 'Borrower'}); | 
        
          | 74 |     my $patron_2 = $builder->build({source => 'Borrower'}); | 77 |     my $patron_2 = $builder->build({source => 'Borrower'}); | 
        
          | 75 |     is( Koha::Patrons->search({ -or => { borrowernumber => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}]}})->delete, 2, ''); | 78 |     is( Koha::Patrons->search({ -or => { borrowernumber => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}]}})->delete, 2, ''); | 
  
    | Lines 81-85
          subtest 'not_covered_yet' => sub {
      
      
        Link Here | 
        
          | 81 |     warning_is { Koha::Patrons->search->not_covered_yet } { carped => 'The method not_covered_yet is not covered by tests' }, "If a method is not covered by tests, the AUTOLOAD method won't execute the method"; | 84 |     warning_is { Koha::Patrons->search->not_covered_yet } { carped => 'The method not_covered_yet is not covered by tests' }, "If a method is not covered by tests, the AUTOLOAD method won't execute the method"; | 
        
          | 82 | }; | 85 | }; | 
        
          | 83 |  | 86 |  | 
            
              |  |  | 87 | subtest 'Exceptions' => sub { | 
            
              | 88 |     plan tests => 2; | 
            
              | 89 |  | 
            
              | 90 |     my $patron_borrowernumber = $builder->build({ source => 'Borrower' })->{ borrowernumber }; | 
            
              | 91 |     my $patron = Koha::Patrons->find( $patron_borrowernumber ); | 
            
              | 92 |  | 
            
              | 93 |     try { | 
            
              | 94 |         $patron->blah('blah'); | 
            
              | 95 |     } catch { | 
            
              | 96 |         ok( $_->isa('Koha::Exceptions::Object::MethodNotFound'), | 
            
              | 97 |             'Calling a non-existent method should raise a Koha::Exceptions::Object::MethodNotFound exception' ); | 
            
              | 98 |     }; | 
            
              | 99 |  | 
            
              | 100 |     try { | 
            
              | 101 |         $patron->set({ blah => 'blah' }); | 
            
              | 102 |     } catch { | 
            
              | 103 |         ok( $_->isa('Koha::Exceptions::Object::PropertyNotFound'), | 
            
              | 104 |             'Setting a non-existent property should raise a Koha::Exceptions::Object::PropertyNotFound exception' ); | 
            
              | 105 |     }; | 
            
              | 106 | }; | 
            
              | 107 |  | 
        
          | 84 | $schema->storage->txn_rollback; | 108 | $schema->storage->txn_rollback; | 
        
          | 85 | 1; | 109 | 1; | 
            
              | 86 | -  |  |  |