From a600f76e57f90ab59574803bbc1f26d672bb6913 Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Tue, 7 Mar 2017 19:19:52 +0200 Subject: [PATCH] Bug 18226 - Remove "use Test::DBIx::Class" instantiations' dangerous code duplication. Replace mock_dbh 1 Content-Type: text/plain; charset=utf-8 t/00-load.t already checks if all of the perl modules can be compiled. The tests deleted in this commit do a duplicate test with t/00-load.t Hence they have become unnecessary. --- t/00-load.t | 2 +- t/Breeding.t | 28 ---------------------------- t/Members/cardnumber.t | 2 +- t/Message.t | 29 ----------------------------- t/Overdues.t | 29 ----------------------------- t/Patron.t | 2 +- t/RotatingCollections.t | 29 ----------------------------- t/Search.t | 2 +- t/SuggestionEngine_AuthorityFile.t | 2 +- t/db_dependent/Context.t | 2 +- 10 files changed, 6 insertions(+), 121 deletions(-) delete mode 100755 t/Breeding.t delete mode 100755 t/Message.t delete mode 100755 t/Overdues.t delete mode 100755 t/RotatingCollections.t diff --git a/t/00-load.t b/t/00-load.t index 36a5bcf..460018c 100644 --- a/t/00-load.t +++ b/t/00-load.t @@ -31,7 +31,7 @@ use t::lib::Mocks; =cut -my $context_module = t::lib::Mocks::mock_dbh; +use Test::DBIx::Class; # Loop through the C4:: modules my $lib = File::Spec->rel2abs('C4'); diff --git a/t/Breeding.t b/t/Breeding.t deleted file mode 100755 index 6effd9f..0000000 --- a/t/Breeding.t +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl - -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# Koha is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Koha; if not, see . - -use Modern::Perl; - -use Test::More tests => 1; -use t::lib::Mocks; - -BEGIN { - # Mock the DB connexion and C4::Context - my $context = t::lib::Mocks::mock_dbh; - use_ok('C4::Breeding'); -} - diff --git a/t/Members/cardnumber.t b/t/Members/cardnumber.t index af3a4bb..f2f7882 100644 --- a/t/Members/cardnumber.t +++ b/t/Members/cardnumber.t @@ -9,7 +9,7 @@ use Koha::Schema; use_ok('C4::Members'); BEGIN { - t::lib::Mocks::mock_dbh; + use Test::DBIx::Class; } my $dbh = C4::Context->dbh; diff --git a/t/Message.t b/t/Message.t deleted file mode 100755 index dc63832..0000000 --- a/t/Message.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/perl - -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# Koha is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Koha; if not, see . - -use Modern::Perl; - -use Test::More tests => 1; -use t::lib::Mocks; - -BEGIN { - # Mock the DB connexion and C4::Context - my $context = t::lib::Mocks::mock_dbh; - use_ok('C4::Message'); -} - -1; diff --git a/t/Overdues.t b/t/Overdues.t deleted file mode 100755 index f0d8a8c..0000000 --- a/t/Overdues.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/perl - -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# Koha is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Koha; if not, see . - -use Modern::Perl; - -use Test::More tests => 1; -use t::lib::Mocks; - -BEGIN { - # Mock the DB connexion and C4::Context - my $context = t::lib::Mocks::mock_dbh; - use_ok('C4::Overdues'); -} - -1; diff --git a/t/Patron.t b/t/Patron.t index c32de10..be66f9d 100755 --- a/t/Patron.t +++ b/t/Patron.t @@ -22,7 +22,7 @@ use Test::Warn; use t::lib::Mocks; BEGIN { - t::lib::Mocks::mock_dbh; + use Test::DBIx::Class; use_ok('Koha::Object'); use_ok('Koha::Patron'); } diff --git a/t/RotatingCollections.t b/t/RotatingCollections.t deleted file mode 100755 index 618703e..0000000 --- a/t/RotatingCollections.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/perl - -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# Koha is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Koha; if not, see . - -use Modern::Perl; - -use Test::More tests => 1; -use t::lib::Mocks; - -BEGIN { - # Mock the DB connexion and C4::Context - my $context = t::lib::Mocks::mock_dbh; - use_ok('C4::RotatingCollections'); -} - -1; diff --git a/t/Search.t b/t/Search.t index 5618ead..5c35419 100755 --- a/t/Search.t +++ b/t/Search.t @@ -21,7 +21,7 @@ use Test::More tests => 3; use t::lib::Mocks; # Mock the DB connexion and C4::Context -my $context = t::lib::Mocks::mock_dbh; +use Test::DBIx::Class; use_ok('C4::Search'); can_ok('C4::Search', diff --git a/t/SuggestionEngine_AuthorityFile.t b/t/SuggestionEngine_AuthorityFile.t index ef6eb42..96ca44d 100755 --- a/t/SuggestionEngine_AuthorityFile.t +++ b/t/SuggestionEngine_AuthorityFile.t @@ -29,7 +29,7 @@ use Test::MockModule; use t::lib::Mocks; # Mock the DB connexion and C4::Context -my $context = t::lib::Mocks::mock_dbh; +use Test::DBIx::Class; use_ok('Koha::SuggestionEngine'); diff --git a/t/db_dependent/Context.t b/t/db_dependent/Context.t index bce0cef..9325c72 100755 --- a/t/db_dependent/Context.t +++ b/t/db_dependent/Context.t @@ -67,7 +67,7 @@ foreach (sort @keys) { ok($config = $koha->{config}, 'Getting $koha->{config} '); # Testing syspref caching -t::lib::Mocks::mock_dbh; +use Test::DBIx::Class; my $history; -- 2.1.4