Bug 23448: Clean up subscription detail template
[koha.git] / t / db_dependent / Patron / HouseboundProfiles.t
blob0a24cf5083151282456ee063252852b94f15c393
1 #!/usr/bin/perl
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>.
18 use Modern::Perl;
20 use Test::More tests => 3;
22 use Koha::Database;
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;
32 # Profile Tests
34 my $profile = $builder->build({ source => 'HouseboundProfile' });
36 is(
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} });
45 my $found_profile = shift @profiles;
46 is(
47 $found_profile->borrowernumber,
48 $profile->{borrowernumber},
49 "Search for created profile."
52 # ->housebound_profile Tests
54 my $visit1 = $builder->build({
55 source => 'HouseboundVisit',
56 value => {
57 borrowernumber => $profile->{borrowernumber},
59 });
60 my $visit2 = $builder->build({
61 source => 'HouseboundVisit',
62 value => {
63 borrowernumber => $profile->{borrowernumber},
65 });
67 is(
68 scalar @{$found_profile->housebound_visits},
70 "Fetch housebound_visits."
73 $schema->storage->txn_rollback;