View | Details | Raw Unified | Return to bug 18361
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Objects.t (-2 / +28 lines)
Lines 19-29 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 14;
22
use Test::More tests => 15;
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 108-113 subtest 'new' => sub { Link Here
108
    Koha::Patron::Categories->find($a_cat_code)->delete;
109
    Koha::Patron::Categories->find($a_cat_code)->delete;
109
};
110
};
110
111
112
subtest 'find' => sub {
113
    plan tests => 4;
114
115
    # check find on a single PK
116
    my $patron = $builder->build({ source => 'Borrower' });
117
    is( Koha::Patrons->find($patron->{borrowernumber})->surname,
118
        $patron->{surname}, "Checking an arbitrary patron column after find"
119
    );
120
    # check find with unique column
121
    my $obj = Koha::Patrons->find($patron->{cardnumber}, { key => 'cardnumber' });
122
    is( $obj->borrowernumber, $patron->{borrowernumber},
123
        'Find with unique column and key specified' );
124
    # check find with an additional where clause in the attrs hash
125
    # we do not expect to find something now
126
    is( Koha::Patrons->find(
127
        $patron->{borrowernumber},
128
        { where => { surname => { '!=', $patron->{surname} }}},
129
    ), undef, 'Additional where clause in find call' );
130
131
    # check find with a composite FK
132
    my $rule = $builder->build({ source => 'Issuingrule' });
133
    my @pk = ( $rule->{branchcode}, $rule->{categorycode}, $rule->{itemtype} );
134
    is( ref(Koha::IssuingRules->find(@pk)), "Koha::IssuingRule",
135
        'Find returned a Koha object for composite primary key' );
136
};
137
111
subtest 'search_related' => sub {
138
subtest 'search_related' => sub {
112
    plan tests => 8;
139
    plan tests => 8;
113
    my $builder   = t::lib::TestBuilder->new;
140
    my $builder   = t::lib::TestBuilder->new;
114
- 

Return to bug 18361