Lines 19-29
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 13; |
22 |
use Test::More tests => 14; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
25 |
use Koha::Authority::Types; |
25 |
use Koha::Authority::Types; |
26 |
use Koha::Cities; |
26 |
use Koha::Cities; |
|
|
27 |
use Koha::IssuingRules; |
27 |
use Koha::Patron::Category; |
28 |
use Koha::Patron::Category; |
28 |
use Koha::Patron::Categories; |
29 |
use Koha::Patron::Categories; |
29 |
use Koha::Patrons; |
30 |
use Koha::Patrons; |
Lines 98-103
subtest 'new' => sub {
Link Here
|
98 |
Koha::Patron::Categories->find($a_cat_code)->delete; |
99 |
Koha::Patron::Categories->find($a_cat_code)->delete; |
99 |
}; |
100 |
}; |
100 |
|
101 |
|
|
|
102 |
subtest 'find' => sub { |
103 |
plan tests => 4; |
104 |
|
105 |
# check find on a single PK |
106 |
my $patron = $builder->build({ source => 'Borrower' }); |
107 |
is( Koha::Patrons->find($patron->{borrowernumber})->surname, |
108 |
$patron->{surname}, "Checking an arbitrary patron column after find" |
109 |
); |
110 |
# check find with unique column |
111 |
my $obj = Koha::Patrons->find($patron->{cardnumber}, { key => 'cardnumber' }); |
112 |
is( $obj->borrowernumber, $patron->{borrowernumber}, |
113 |
'Find with unique column and key specified' ); |
114 |
# check find with an additional where clause in the attrs hash |
115 |
# we do not expect to find something now |
116 |
is( Koha::Patrons->find( |
117 |
$patron->{borrowernumber}, |
118 |
{ where => { surname => { '!=', $patron->{surname} }}}, |
119 |
), undef, 'Additional where clause in find call' ); |
120 |
|
121 |
# check find with a composite FK |
122 |
my $rule = $builder->build({ source => 'Issuingrule' }); |
123 |
my @pk = ( $rule->{branchcode}, $rule->{categorycode}, $rule->{itemtype} ); |
124 |
is( ref(Koha::IssuingRules->find(@pk)), "Koha::IssuingRule", |
125 |
'Find returned a Koha object for composite primary key' ); |
126 |
}; |
127 |
|
101 |
subtest 'search_related' => sub { |
128 |
subtest 'search_related' => sub { |
102 |
plan tests => 8; |
129 |
plan tests => 8; |
103 |
my $builder = t::lib::TestBuilder->new; |
130 |
my $builder = t::lib::TestBuilder->new; |
104 |
- |
|
|