Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 16; |
22 |
use Test::More tests => 17; |
23 |
use Test::Exception; |
23 |
use Test::Exception; |
24 |
use Test::Warn; |
24 |
use Test::Warn; |
25 |
|
25 |
|
Lines 29-34
use Koha::DateUtils qw(dt_from_string);
Link Here
|
29 |
use Koha::ArticleRequests; |
29 |
use Koha::ArticleRequests; |
30 |
use Koha::Patrons; |
30 |
use Koha::Patrons; |
31 |
use Koha::Patron::Relationships; |
31 |
use Koha::Patron::Relationships; |
|
|
32 |
use Koha::Patron::Files; |
32 |
|
33 |
|
33 |
use t::lib::TestBuilder; |
34 |
use t::lib::TestBuilder; |
34 |
use t::lib::Mocks; |
35 |
use t::lib::Mocks; |
Lines 1137-1139
subtest 'recalls() tests' => sub {
Link Here
|
1137 |
|
1138 |
|
1138 |
$schema->storage->txn_rollback; |
1139 |
$schema->storage->txn_rollback; |
1139 |
}; |
1140 |
}; |
1140 |
- |
1141 |
|
|
|
1142 |
subtest 'filecount() tests' => sub { |
1143 |
|
1144 |
plan tests => 3; |
1145 |
|
1146 |
$schema->storage->txn_begin; |
1147 |
|
1148 |
t::lib::Mocks::mock_preference( 'EnableBorrowerFiles', 1 ); |
1149 |
|
1150 |
my $patron_1 = $builder->build_object({ class => 'Koha::Patrons' }); |
1151 |
|
1152 |
is($patron_1->filecount, 0 , "Patron has 0 files"); |
1153 |
|
1154 |
my $bf = Koha::Patron::Files->new( borrowernumber => $patron_1->id ); |
1155 |
$bf->AddFile( name => 'name1', type => 'type1', |
1156 |
description => '', content => 'content1' ); |
1157 |
is($patron_1->filecount, 1 , "Patron has 1 files"); |
1158 |
$bf->AddFile( name => 'name2', type => 'type2', |
1159 |
description => '', content => 'content2' ); |
1160 |
is($patron_1->filecount, 2 , "Patron has many files"); |
1161 |
|
1162 |
$schema->storage->txn_rollback; |
1163 |
}; |