Bug 22001: Remove the RaiseError occurrences from tests
Unless it is needed! Also remove $dbh when not used later. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
dcc9381691
commit
2849b188c8
|
|
@ -125,9 +125,6 @@ sub _check_fields_of_orders {
|
|||
my $schema = Koha::Database->new()->schema();
|
||||
$schema->storage->txn_begin();
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
# Creating some orders
|
||||
my $bookseller = Koha::Acquisition::Bookseller->new(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ use MARC::Record;
|
|||
|
||||
my $schema = Koha::Database->new()->schema();
|
||||
$schema->storage->txn_begin();
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
my $itemtype = $builder->build({ source => 'Itemtype' })->{ itemtype };
|
||||
|
|
|
|||
|
|
@ -14,9 +14,6 @@ use Koha::Acquisition::Orders;
|
|||
my $schema = Koha::Database->new()->schema();
|
||||
$schema->storage->txn_begin();
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $supplier = Koha::Acquisition::Bookseller->new(
|
||||
{
|
||||
name => 'my vendor',
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ use MARC::Record;
|
|||
#Start transaction
|
||||
my $schema = Koha::Database->new()->schema();
|
||||
$schema->storage->txn_begin();
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $bookseller = Koha::Acquisition::Bookseller->new(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ BEGIN {
|
|||
my $schema = Koha::Database->new()->schema();
|
||||
$schema->storage->txn_begin();
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
$dbh->do(q{DELETE FROM aqinvoices});
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ use t::lib::Mocks;
|
|||
|
||||
my $schema = Koha::Database->new()->schema();
|
||||
$schema->storage->txn_begin();
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
my $logged_in_user = $builder->build_object({ class => 'Koha::Patrons' });
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ my $schema = Koha::Database->new()->schema();
|
|||
$schema->storage->txn_begin();
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $curcode = $builder->build({ source => 'Currency' })->{currencycode};
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@ use MARC::Record;
|
|||
my $schema = Koha::Database->new()->schema();
|
||||
$schema->storage->txn_begin();
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
|
||||
my $bookseller1 = Koha::Acquisition::Bookseller->new(
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ my $schema = Koha::Database->new()->schema();
|
|||
$schema->storage->txn_begin();
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
$dbh->do(q{
|
||||
DELETE FROM aqorders;
|
||||
|
|
|
|||
|
|
@ -13,9 +13,6 @@ use t::lib::Mocks;
|
|||
my $schema = Koha::Database->new()->schema();
|
||||
$schema->storage->txn_begin();
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
|
||||
my $bookseller_inc_tax = Koha::Acquisition::Bookseller->new(
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ my $builder = t::lib::TestBuilder->new;
|
|||
our $cache = Koha::Caches->get_instance;
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
$dbh->do("DELETE FROM circulation_rules");
|
||||
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@ BEGIN {
|
|||
my $schema = Koha::Database->new()->schema();
|
||||
$schema->storage->txn_begin();
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
map { $_->delete() } Koha::AudioAlerts->search();
|
||||
|
||||
## Check the basics
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ BEGIN {
|
|||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
C4::Context->disable_syspref_cache();
|
||||
t::lib::Mocks::mock_preference('OPACBaseURL','http://localhost');
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ my $dbh = C4::Context->dbh;
|
|||
my $database = Koha::Database->new();
|
||||
my $schema = $database->schema();
|
||||
$schema->storage->txn_begin();
|
||||
$dbh->{RaiseError} = 1;
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
|
||||
#Start tests
|
||||
|
|
|
|||
|
|
@ -105,9 +105,6 @@ my $now_value = dt_from_string;
|
|||
my $mocked_datetime = Test::MockModule->new('DateTime');
|
||||
$mocked_datetime->mock( 'now', sub { return $now_value->clone; } );
|
||||
|
||||
# Start transaction
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $cache = Koha::Caches->get_instance();
|
||||
$dbh->do(q|DELETE FROM special_holidays|);
|
||||
$dbh->do(q|DELETE FROM repeatable_holidays|);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ my $dbh = $schema->storage->dbh;
|
|||
my $builder = t::lib::TestBuilder->new();
|
||||
|
||||
# Start transaction
|
||||
$dbh->{RaiseError} = 1;
|
||||
$schema->storage->txn_begin();
|
||||
|
||||
my $itemtype = $builder->build({ source => 'Itemtype' })->{ itemtype };
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ my $schema = Koha::Database->schema;
|
|||
$schema->storage->txn_begin;
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
|
||||
my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype};
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ BEGIN {
|
|||
my $schema = Koha::Database->schema;
|
||||
$schema->storage->txn_begin;
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode};
|
||||
my $itemtype = $builder->build(
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ my $dbh = C4::Context->dbh;
|
|||
my $schema = Koha::Database->new()->schema();
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
|
||||
# Start transaction
|
||||
$dbh->{RaiseError} = 1;
|
||||
$schema->storage->txn_begin();
|
||||
|
||||
my $now_value = DateTime->now();
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ my $dbh = C4::Context->dbh;
|
|||
|
||||
my $database = Koha::Database->new();
|
||||
my $schema = $database->schema();
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
sub run_hiding_tests {
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ my $schema = Koha::Database->schema;
|
|||
$schema->storage->txn_begin;
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
$dbh->do("DELETE FROM reserves");
|
||||
$dbh->do("DELETE FROM old_reserves");
|
||||
|
|
|
|||
|
|
@ -57,8 +57,6 @@ my $column_name = $column_names[0];
|
|||
ok( column_exists( 'borrowers', $column_name ), 'Known column does exist' );
|
||||
ok( ! column_exists( 'borrowers', 'xxx'), 'Column xxx does not exist' );
|
||||
{
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
ok( ! column_exists( 'this_table_will_never_exist', 'xxx'), 'Column xxx does not exist, the table does not exist' );
|
||||
}
|
||||
my @constraint_names = $source->unique_constraint_names();
|
||||
|
|
|
|||
|
|
@ -80,8 +80,6 @@ subtest 'General Add, Get and Del tests' => sub {
|
|||
|
||||
|
||||
# Do not modify anything, and do not explode!
|
||||
my $dbh = C4::Context->dbh;
|
||||
local $dbh->{RaiseError} = 1;
|
||||
$getitem->set({})->store;
|
||||
|
||||
# Modify item; setting barcode.
|
||||
|
|
|
|||
|
|
@ -26,10 +26,6 @@ use t::lib::TestBuilder;
|
|||
|
||||
my $schema = Koha::Database->schema;
|
||||
$schema->storage->txn_begin;
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
# Start transaction
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
my $nb_of_currencies = Koha::Acquisition::Currencies->search->count;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ BEGIN {
|
|||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
## new() parameter handling check
|
||||
is(Koha::Misc::Files->new(), undef, "new() param check test/0");
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ $schema->storage->txn_begin();
|
|||
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
$dbh->do(q|DELETE FROM letter|);
|
||||
$dbh->do(q|DELETE FROM message_queue|);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ $schema->storage->txn_begin();
|
|||
my $builder = t::lib::TestBuilder->new();
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
$dbh->do(q|DELETE FROM letter|);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@ use_ok('Koha::Patron::Password::Recovery');
|
|||
my $schema = Koha::Database->new()->schema();
|
||||
$schema->storage->txn_begin();
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
#
|
||||
# Start with fresh data
|
||||
#
|
||||
|
|
|
|||
|
|
@ -30,11 +30,6 @@ BEGIN {
|
|||
use_ok('Koha::Patron::Relationships');
|
||||
}
|
||||
|
||||
# Start transaction
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{AutoCommit} = 0;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $builder = t::lib::TestBuilder->new();
|
||||
|
||||
# Father
|
||||
|
|
|
|||
|
|
@ -264,6 +264,7 @@ subtest 'get_saved_reports' => sub {
|
|||
defined($errors) && exists($errors->{queryerr}),
|
||||
'attempting to run a report with an SQL syntax error returns error message (Bug 12214)'
|
||||
);
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
is_deeply( get_report_areas(), [ 'CIRC', 'CAT', 'PAT', 'ACQ', 'ACC', 'SER' ],
|
||||
"get_report_areas returns the correct array of report areas");
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use Modern::Perl;
|
|||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
use C4::Serials::Frequency;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use Koha::Database;
|
|||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
use C4::Serials::Frequency;
|
||||
use C4::Serials;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use Koha::Database;
|
|||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
use C4::Serials::Numberpattern;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ my $library2 = $builder->build({
|
|||
});
|
||||
my $patron_category = $builder->build({ source => 'Category' });
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
my $record = MARC::Record->new();
|
||||
$record->append_fields(
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ my $schema = Koha::Database->schema;
|
|||
$schema->storage->txn_begin;
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
$dbh->do(q|DELETE FROM reserves|);
|
||||
$dbh->do(q|DELETE FROM issues|);
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ my $borrower;
|
|||
|
||||
sub build_test_objects {
|
||||
|
||||
$dbh->{RaiseError} = 1;
|
||||
|
||||
# Set only to avoid exception.
|
||||
t::lib::Mocks::mock_preference('dateformat', 'metric');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue