@@ -, +, @@
---
t/db_dependent/Koha/Patrons.t | 6 ------
t/lib/TestBuilder.pm | 10 ++++++++--
2 files changed, 8 insertions(+), 8 deletions(-)
--- a/t/db_dependent/Koha/Patrons.t
+++ a/t/db_dependent/Koha/Patrons.t
@@ -40,7 +40,6 @@ use t::lib::TestBuilder;
use t::lib::Mocks;
my $schema = Koha::Database->new->schema;
-$schema->storage->txn_begin;
my $builder = t::lib::TestBuilder->new;
my $library = $builder->build({source => 'Branch' });
@@ -1425,7 +1424,6 @@ subtest 'Log cardnumber change' => sub {
is( scalar @logs, 2, 'With BorrowerLogs, Change in cardnumber should be logged, as well as general alert of patron mod.' );
};
-$schema->storage->txn_rollback;
subtest 'Test Koha::Patrons::merge' => sub {
plan tests => 110;
@@ -1434,7 +1432,6 @@ subtest 'Test Koha::Patrons::merge' => sub {
my $resultsets = $Koha::Patron::RESULTSET_PATRON_ID_MAPPING;
- $schema->storage->txn_begin;
my $keeper = $builder->build_object({ class => 'Koha::Patrons' });
my $loser_1 = $builder->build({ source => 'Borrower' })->{borrowernumber};
@@ -1469,13 +1466,11 @@ subtest 'Test Koha::Patrons::merge' => sub {
is( Koha::Patrons->find($loser_1), undef, 'Loser 1 has been deleted' );
is( Koha::Patrons->find($loser_2), undef, 'Loser 2 has been deleted' );
- $schema->storage->txn_rollback;
};
subtest '->store' => sub {
plan tests => 3;
my $schema = Koha::Database->new->schema;
- $schema->storage->txn_begin;
my $print_error = $schema->storage->dbh->{PrintError};
$schema->storage->dbh->{PrintError} = 0; ; # FIXME This does not longer work - because of the transaction in Koha::Patron->store?
@@ -1497,7 +1492,6 @@ subtest '->store' => sub {
is( $patron_1->password, $digest, 'Password should not have changed on ->store');
$schema->storage->dbh->{PrintError} = $print_error;
- $schema->storage->txn_rollback;
};
--- a/t/lib/TestBuilder.pm
+++ a/t/lib/TestBuilder.pm
@@ -433,14 +433,20 @@ sub _gen_datetime {
sub _gen_text {
my ($self, $params) = @_;
# From perldoc String::Random
- my $size = $params->{info}{size} // 10;
+ my $size = $params->{info}{size} // 100;
$size -= alt_rand(0.5 * $size);
+ my $xss_data;
+ if ( $size > 27 ) { #
+ $xss_data = 1;
+ $size -= 27;
+ }
my $regex = $size > 1
? '[A-Za-z][A-Za-z0-9_]{'.($size-1).'}'
: '[A-Za-z]';
my $random = String::Random->new( rand_gen => \&alt_rand );
# rand_gen is only supported from 0.27 onward
- return $random->randregex($regex);
+ $random = $random->randregex($regex);
+ return $xss_data ? qq|| : $random;
}
sub alt_rand { #Alternative randomizer
--