|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 32; |
22 |
use Test::More tests => 33; |
| 23 |
use Test::Exception; |
23 |
use Test::Exception; |
| 24 |
use Test::Warn; |
24 |
use Test::Warn; |
| 25 |
use Time::Fake; |
25 |
use Time::Fake; |
|
Lines 2234-2236
subtest 'guarantor requirements tests' => sub {
Link Here
|
| 2234 |
'Koha::Exceptions::Patron::Relationship::NoGuarantor', |
2234 |
'Koha::Exceptions::Patron::Relationship::NoGuarantor', |
| 2235 |
'Exception thrown when guarantor is deleted.'; |
2235 |
'Exception thrown when guarantor is deleted.'; |
| 2236 |
}; |
2236 |
}; |
| 2237 |
- |
2237 |
|
|
|
2238 |
subtest 'Scrub the note fields' => sub { |
| 2239 |
plan tests => 4; |
| 2240 |
|
| 2241 |
$schema->storage->txn_begin; |
| 2242 |
|
| 2243 |
my $bad_message = '<script>alert("booh!")</script><span>all</span><b>good</b>now'; |
| 2244 |
my $cleaned_message = '<span>all</span><b>good</b>now'; |
| 2245 |
my $tmp_patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 2246 |
my $patron_data = $tmp_patron->unblessed; |
| 2247 |
$tmp_patron->delete; |
| 2248 |
delete $tmp_patron->{borrowernumber}; |
| 2249 |
|
| 2250 |
my $patron = Koha::Patron->new( |
| 2251 |
|
| 2252 |
{ |
| 2253 |
%$patron_data, |
| 2254 |
borrowernotes => $bad_message, opacnote => $bad_message, |
| 2255 |
} |
| 2256 |
)->store; |
| 2257 |
|
| 2258 |
is( $patron->get_from_storage->borrowernotes, $cleaned_message ); |
| 2259 |
is( $patron->get_from_storage->opacnote, $cleaned_message ); |
| 2260 |
|
| 2261 |
$patron->borrowernotes($bad_message)->store; |
| 2262 |
$patron->opacnote($bad_message)->store; |
| 2263 |
|
| 2264 |
is( $patron->get_from_storage->borrowernotes, $cleaned_message ); |
| 2265 |
is( $patron->get_from_storage->opacnote, $cleaned_message ); |
| 2266 |
|
| 2267 |
$schema->storage->txn_rollback; |
| 2268 |
}; |