Lines 1-6
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
3 |
# Copyright 2015 Koha Development team |
3 |
# Copyright 2015-2019 Koha Development team |
4 |
# |
4 |
# |
5 |
# This file is part of Koha |
5 |
# This file is part of Koha |
6 |
# |
6 |
# |
Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 6; |
22 |
use Test::More tests => 8; |
23 |
use Test::Exception; |
23 |
use Test::Exception; |
24 |
|
24 |
|
25 |
use Koha::Suggestion; |
25 |
use Koha::Suggestion; |
Lines 171-173
subtest 'constraints' => sub {
Link Here
|
171 |
$schema->storage->dbh->{PrintError} = $print_error; |
171 |
$schema->storage->dbh->{PrintError} = $print_error; |
172 |
$schema->storage->txn_rollback; |
172 |
$schema->storage->txn_rollback; |
173 |
}; |
173 |
}; |
174 |
- |
174 |
|
|
|
175 |
subtest 'manager, suggester, rejecter, last_modifier' => sub { |
176 |
plan tests => 8; |
177 |
$schema->storage->txn_begin; |
178 |
|
179 |
my $suggestion = $builder->build_object( { class => 'Koha::Suggestions' } ); |
180 |
|
181 |
is( ref( $suggestion->manager ), |
182 |
'Koha::Patron', |
183 |
'->manager should have returned a Koha::Patron object' ); |
184 |
is( ref( $suggestion->rejecter ), |
185 |
'Koha::Patron', |
186 |
'->rejecter should have returned a Koha::Patron object' ); |
187 |
is( ref( $suggestion->suggester ), |
188 |
'Koha::Patron', |
189 |
'->suggester should have returned a Koha::Patron object' ); |
190 |
is( ref( $suggestion->last_modifier ), |
191 |
'Koha::Patron', |
192 |
'->last_modifier should have returned a Koha::Patron object' ); |
193 |
|
194 |
$suggestion->set( |
195 |
{ |
196 |
managedby => undef, |
197 |
rejectedby => undef, |
198 |
suggestedby => undef, |
199 |
lastmodificationby => undef |
200 |
} |
201 |
); |
202 |
|
203 |
is( $suggestion->manager, undef, |
204 |
'->manager should have returned undef if no manager set' ); |
205 |
is( $suggestion->rejecter, undef, |
206 |
'->rejecter should have returned undef if no rejecter set' ); |
207 |
is( $suggestion->suggester, undef, |
208 |
'->suggester should have returned undef if no suggester set' ); |
209 |
is( $suggestion->last_modifier, |
210 |
undef, |
211 |
'->last_modifier should have returned undef if no last_modifier set' ); |
212 |
|
213 |
$schema->storage->txn_rollback; |
214 |
}; |
215 |
|
216 |
subtest 'fund' => sub { |
217 |
plan tests => 2; |
218 |
|
219 |
$schema->storage->txn_begin; |
220 |
|
221 |
my $suggestion = $builder->build_object( { class => 'Koha::Suggestions' } ); |
222 |
is( ref( $suggestion->fund ), |
223 |
'Koha::Acquisition::Fund', |
224 |
'->fund should have returned a Koha::Acquisition::Fund object' ); |
225 |
|
226 |
$suggestion->set( { budgetid => undef } ); |
227 |
|
228 |
is( $suggestion->fund, undef, |
229 |
'->fund should have returned undef if not fund set' ); |
230 |
|
231 |
$schema->storage->txn_rollback; |
232 |
}; |