Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 59; |
20 |
use Test::More tests => 54; |
21 |
|
21 |
|
22 |
use C4::Context; |
22 |
use C4::Context; |
23 |
|
23 |
|
Lines 90-96
Koha::Patron::Relationship->new({ guarantor_id => $chelsea->id, guarantee_id =>
Link Here
|
90 |
|
90 |
|
91 |
my @gr; |
91 |
my @gr; |
92 |
|
92 |
|
93 |
@gr = $kyle->guarantee_relationships(); |
93 |
@gr = $kyle->guarantee_relationships()->as_list; |
94 |
is( @gr, 2, 'Found 2 guarantee relationships for father' ); |
94 |
is( @gr, 2, 'Found 2 guarantee relationships for father' ); |
95 |
is( $gr[0]->guarantor_id, $kyle->id, 'Guarantor matches for first relationship' ); |
95 |
is( $gr[0]->guarantor_id, $kyle->id, 'Guarantor matches for first relationship' ); |
96 |
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' ); |
96 |
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' ); |
Lines 108-114
is( $gr[1]->guarantee->id, $kylie->id, 'Koha::Patron returned is the correct gua
Link Here
|
108 |
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' ); |
108 |
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' ); |
109 |
is( $gr[1]->guarantor->id, $kyle->id, 'Koha::Patron returned is the correct guarantor' ); |
109 |
is( $gr[1]->guarantor->id, $kyle->id, 'Koha::Patron returned is the correct guarantor' ); |
110 |
|
110 |
|
111 |
@gr = $chelsea->guarantee_relationships(); |
111 |
@gr = $chelsea->guarantee_relationships()->as_list; |
112 |
is( @gr, 2, 'Found 2 guarantee relationships for mother' ); |
112 |
is( @gr, 2, 'Found 2 guarantee relationships for mother' ); |
113 |
is( $gr[0]->guarantor_id, $chelsea->id, 'Guarantor matches for first relationship' ); |
113 |
is( $gr[0]->guarantor_id, $chelsea->id, 'Guarantor matches for first relationship' ); |
114 |
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' ); |
114 |
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' ); |
Lines 126-132
is( $gr[1]->guarantee->id, $kylie->id, 'Koha::Patron returned is the correct gua
Link Here
|
126 |
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' ); |
126 |
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' ); |
127 |
is( $gr[1]->guarantor->id, $chelsea->id, 'Koha::Patron returned is the correct guarantor' ); |
127 |
is( $gr[1]->guarantor->id, $chelsea->id, 'Koha::Patron returned is the correct guarantor' ); |
128 |
|
128 |
|
129 |
@gr = $daria->guarantor_relationships(); |
129 |
@gr = $daria->guarantor_relationships()->as_list; |
130 |
is( @gr, 2, 'Found 4 guarantor relationships for child' ); |
130 |
is( @gr, 2, 'Found 4 guarantor relationships for child' ); |
131 |
is( $gr[0]->guarantor_id, $kyle->id, 'Guarantor matches for first relationship' ); |
131 |
is( $gr[0]->guarantor_id, $kyle->id, 'Guarantor matches for first relationship' ); |
132 |
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' ); |
132 |
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' ); |
Lines 144-156
is( $gr[1]->guarantee->id, $daria->id, 'Koha::Patron returned is the correct gua
Link Here
|
144 |
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' ); |
144 |
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' ); |
145 |
is( $gr[1]->guarantor->id, $chelsea->id, 'Koha::Patron returned is the correct guarantor' ); |
145 |
is( $gr[1]->guarantor->id, $chelsea->id, 'Koha::Patron returned is the correct guarantor' ); |
146 |
|
146 |
|
147 |
my @siblings = $daria->siblings; |
|
|
148 |
is( @siblings, 1, 'Method siblings called in list context returns list' ); |
149 |
is( ref($siblings[0]), 'Koha::Patron', 'List contains a Koha::Patron' ); |
150 |
is( $siblings[0]->firstname, 'Kylie', 'Sibling from list first name matches correctly' ); |
151 |
is( $siblings[0]->surname, 'Hall', 'Sibling from list surname matches correctly' ); |
152 |
is( $siblings[0]->id, $kylie->id, 'Sibling from list patron id matches correctly' ); |
153 |
|
154 |
my $siblings = $daria->siblings; |
147 |
my $siblings = $daria->siblings; |
155 |
my $sibling = $siblings->next(); |
148 |
my $sibling = $siblings->next(); |
156 |
is( ref($siblings), 'Koha::Patrons', 'Calling siblings in scalar context results in a Koha::Patrons object' ); |
149 |
is( ref($siblings), 'Koha::Patrons', 'Calling siblings in scalar context results in a Koha::Patrons object' ); |