3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20 use Test::More tests => 3;
23 use Koha::Patron::HouseboundProfiles;
25 use t::lib::TestBuilder;
27 my $schema = Koha::Database->new->schema;
28 $schema->storage->txn_begin;
30 my $builder = t::lib::TestBuilder->new;
34 my $profile = $builder->build({ source => 'HouseboundProfile' });
37 Koha::Patron::HouseboundProfiles
38 ->find($profile->{borrowernumber})->borrowernumber,
39 $profile->{borrowernumber},
40 "Find created profile."
43 my @profiles = Koha::Patron::HouseboundProfiles
44 ->search({ day => $profile->{day} })->as_list;
45 my $found_profile = shift @profiles;
47 $found_profile->borrowernumber,
48 $profile->{borrowernumber},
49 "Search for created profile."
52 # ->housebound_profile Tests
54 my $visit1 = $builder->build({
55 source => 'HouseboundVisit',
57 borrowernumber => $profile->{borrowernumber},
60 my $visit2 = $builder->build({
61 source => 'HouseboundVisit',
63 borrowernumber => $profile->{borrowernumber},
68 scalar @{$found_profile->housebound_visits},
70 "Fetch housebound_visits."
73 $schema->storage->txn_rollback;