| Lines 20-25
          use Modern::Perl;
      
      
        Link Here | 
        
          | 20 | use Test::More tests => 54; | 20 | use Test::More tests => 54; | 
        
          | 21 |  | 21 |  | 
        
          | 22 | use C4::Context; | 22 | use C4::Context; | 
            
              |  |  | 23 | use Koha::Database; | 
        
          | 23 |  | 24 |  | 
        
          | 24 | use t::lib::TestBuilder; | 25 | use t::lib::TestBuilder; | 
        
          | 25 |  | 26 |  | 
  
    | Lines 30-86
          BEGIN {
      
      
        Link Here | 
        
          | 30 |     use_ok('Koha::Patron::Relationships'); | 31 |     use_ok('Koha::Patron::Relationships'); | 
        
          | 31 | } | 32 | } | 
        
          | 32 |  | 33 |  | 
            
              |  |  | 34 | my $schema  = Koha::Database->new->schema; | 
        
          | 33 | my $builder = t::lib::TestBuilder->new(); | 35 | my $builder = t::lib::TestBuilder->new(); | 
        
          | 34 |  | 36 |  | 
            
              |  |  | 37 | $schema->storage->txn_begin; | 
            
              | 38 |  | 
        
          | 35 | # Father | 39 | # Father | 
          
            
              | 36 | my $kyle = Koha::Patrons->find( | 40 | my $kyle = $builder->build_object( | 
            
              | 37 |     $builder->build( | 41 |     { | 
            
              | 38 |         { | 42 |         class => 'Koha::Patrons', | 
            
              | 39 |             source => 'Borrower', | 43 |         value => { | 
            
              | 40 |             value  => { | 44 |             firstname => 'Kyle', | 
            
              | 41 |                 firstname => 'Kyle', | 45 |             surname   => 'Hall', | 
            
              | 42 |                 surname   => 'Hall', |  |  | 
            
              | 43 |             } | 
        
          | 44 |         } | 46 |         } | 
          
            
              | 45 |     )->{borrowernumber} | 47 |     } | 
        
          | 46 | ); | 48 | ); | 
        
          | 47 |  | 49 |  | 
        
          | 48 | # Mother | 50 | # Mother | 
          
            
              | 49 | my $chelsea = Koha::Patrons->find( | 51 | my $chelsea = $builder->build_object( | 
            
              | 50 |     $builder->build( | 52 |     { | 
            
              | 51 |         { | 53 |         class => 'Koha::Patrons', | 
            
              | 52 |             source => 'Borrower', | 54 |         value => { | 
            
              | 53 |             value  => { | 55 |             firstname => 'Chelsea', | 
            
              | 54 |                 firstname => 'Chelsea', | 56 |             surname   => 'Hall', | 
            
              | 55 |                 surname   => 'Hall', |  |  | 
            
              | 56 |             } | 
        
          | 57 |         } | 57 |         } | 
          
            
              | 58 |     )->{borrowernumber} | 58 |     } | 
        
          | 59 | ); | 59 | ); | 
        
          | 60 |  | 60 |  | 
        
          | 61 | # Children | 61 | # Children | 
          
            
              | 62 | my $daria = Koha::Patrons->find( | 62 | my $daria = $builder->build_object( | 
            
              | 63 |     $builder->build( | 63 |     { | 
            
              | 64 |         { | 64 |         class => 'Koha::Patrons', | 
            
              | 65 |             source => 'Borrower', | 65 |         value => { | 
            
              | 66 |             value  => { | 66 |             firstname => 'Daria', | 
            
              | 67 |                 firstname => 'Daria', | 67 |             surname   => 'Hall', | 
            
              | 68 |                 surname   => 'Hall', |  |  | 
            
              | 69 |             } | 
        
          | 70 |         } | 68 |         } | 
          
            
              | 71 |     )->{borrowernumber} | 69 |     } | 
        
          | 72 | ); | 70 | ); | 
        
          | 73 |  | 71 |  | 
          
            
              | 74 | my $kylie = Koha::Patrons->find( | 72 | my $kylie = $builder->build_object( | 
            
              | 75 |     $builder->build( | 73 |     { | 
            
              | 76 |         { | 74 |         class => 'Koha::Patrons', | 
            
              | 77 |             source => 'Borrower', | 75 |         value => { | 
            
              | 78 |             value  => { | 76 |             firstname => 'Kylie', | 
            
              | 79 |                 firstname => 'Kylie', | 77 |             surname   => 'Hall', | 
            
              | 80 |                 surname   => 'Hall', |  |  | 
            
              | 81 |             } | 
        
          | 82 |         } | 78 |         } | 
          
            
              | 83 |     )->{borrowernumber} | 79 |     } | 
        
          | 84 | ); | 80 | ); | 
        
          | 85 |  | 81 |  | 
        
          | 86 | Koha::Patron::Relationship->new({ guarantor_id => $kyle->id, guarantee_id => $daria->id, relationship => 'father' })->store(); | 82 | Koha::Patron::Relationship->new({ guarantor_id => $kyle->id, guarantee_id => $daria->id, relationship => 'father' })->store(); | 
  
    | Lines 152-155
          is( $sibling->firstname, 'Kylie', 'Sibling from scalar first name matches correc
      
      
        Link Here | 
        
          | 152 | is( $sibling->surname, 'Hall', 'Sibling from scalar surname matches correctly' ); | 148 | is( $sibling->surname, 'Hall', 'Sibling from scalar surname matches correctly' ); | 
        
          | 153 | is( $sibling->id, $kylie->id, 'Sibling from scalar patron id matches correctly' ); | 149 | is( $sibling->id, $kylie->id, 'Sibling from scalar patron id matches correctly' ); | 
        
          | 154 |  | 150 |  | 
          
            
              | 155 | 1; | 151 | $schema->storage->txn_rollback; | 
            
              | 156 | -  |  |  |