Bug 18226 - Remove "use Test::DBIx::Class" instantiations' dangerous code duplication
Is 'instantiations' even a word? Use a Test::DBIx::Class defaults instead. Save your keyboard and prevent horrible bugs from emerging from rampant code duplication. This change doesn't seem to have any impact on the speed of executing those tests. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
617988a7c1
commit
8bf72439c0
|
|
@ -34,7 +34,7 @@ BEGIN {
|
|||
}
|
||||
}
|
||||
|
||||
use Test::DBIx::Class { schema_class => 'Koha::Schema', connect_info => ['dbi:SQLite:dbname=:memory:','',''] };
|
||||
use Test::DBIx::Class;
|
||||
|
||||
# Mock Variables
|
||||
my $matchpoint = 'userid';
|
||||
|
|
|
|||
|
|
@ -33,12 +33,8 @@ BEGIN {
|
|||
|
||||
use_ok('C4::Biblio');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'Biblio' ;
|
||||
#use Test::DBIx::Class {}, 'Biblio';
|
||||
use Test::DBIx::Class; #No difference between these two invocations in time taken to execute tests.
|
||||
|
||||
sub fixtures {
|
||||
my ( $data ) = @_;
|
||||
|
|
|
|||
|
|
@ -37,12 +37,7 @@ BEGIN {
|
|||
|
||||
use_ok('Koha::Calendar');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'Biblio' ;
|
||||
use Test::DBIx::Class;
|
||||
|
||||
sub fixtures {
|
||||
my ( $data ) = @_;
|
||||
|
|
|
|||
|
|
@ -32,12 +32,7 @@ BEGIN {
|
|||
|
||||
use_ok('C4::Images');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'Biblioimage' ;
|
||||
use Test::DBIx::Class;
|
||||
|
||||
# Make the code in the module use our mocked Koha::Schema/Koha::Database
|
||||
my $db = Test::MockModule->new('Koha::Database');
|
||||
|
|
|
|||
7
t/Koha.t
7
t/Koha.t
|
|
@ -33,12 +33,7 @@ BEGIN {
|
|||
|
||||
use_ok('C4::Koha');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'Branch' ;
|
||||
use Test::DBIx::Class;
|
||||
|
||||
sub fixtures {
|
||||
my ( $libraries ) = @_;
|
||||
|
|
|
|||
|
|
@ -30,12 +30,7 @@ BEGIN {
|
|||
}
|
||||
}
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'Letter' ;
|
||||
use Test::DBIx::Class;
|
||||
use t::lib::Mocks;
|
||||
|
||||
fixtures_ok [
|
||||
|
|
|
|||
|
|
@ -35,12 +35,7 @@ BEGIN {
|
|||
|
||||
use_ok('C4::Matcher');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'MarcMatcher' ;
|
||||
use Test::DBIx::Class;
|
||||
|
||||
fixtures_ok [
|
||||
MarcMatcher => [
|
||||
|
|
|
|||
|
|
@ -32,12 +32,7 @@ BEGIN {
|
|||
|
||||
use_ok('C4::Members::AttributeTypes');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'BorrowerAttributeType', 'Category' ;
|
||||
use Test::DBIx::Class;
|
||||
|
||||
fixtures_ok [
|
||||
Category => [
|
||||
|
|
|
|||
|
|
@ -60,12 +60,7 @@ BEGIN {
|
|||
}
|
||||
}
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'Borrower', 'BorrowerSync';
|
||||
use Test::DBIx::Class {}, 'Borrower', 'BorrowerSync'; #Also loads those modules.
|
||||
|
||||
# Make the code in the module use our mocked Koha::Schema/Koha::Database
|
||||
my $db = Test::MockModule->new('Koha::Database');
|
||||
|
|
|
|||
|
|
@ -20,12 +20,7 @@ use_ok('Koha::Number::Price');
|
|||
|
||||
t::lib::Mocks::mock_preference( 'gist', '0.02|0.05|0.196' );
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'Currency' ;
|
||||
use Test::DBIx::Class;
|
||||
|
||||
my $db = Test::MockModule->new('Koha::Database');
|
||||
$db->mock( _new_schema => sub { return Schema(); } );
|
||||
|
|
|
|||
|
|
@ -34,12 +34,7 @@ BEGIN {
|
|||
use_ok('C4::SocialData');
|
||||
}
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'SocialData', 'Biblioitem' ;
|
||||
use Test::DBIx::Class;
|
||||
|
||||
fixtures_ok [
|
||||
Biblioitem => [
|
||||
|
|
|
|||
15
t/XSLT.t
15
t/XSLT.t
|
|
@ -27,7 +27,7 @@ use Module::Load::Conditional qw/check_install/;
|
|||
|
||||
BEGIN {
|
||||
if ( check_install( module => 'Test::DBIx::Class' ) ) {
|
||||
plan tests => 10;
|
||||
plan tests => 9;
|
||||
} else {
|
||||
plan skip_all => "Need Test::DBIx::Class"
|
||||
}
|
||||
|
|
@ -35,18 +35,7 @@ BEGIN {
|
|||
use_ok('C4::XSLT');
|
||||
};
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'Branch' ;
|
||||
|
||||
fixtures_ok [
|
||||
Branch => [
|
||||
],
|
||||
];
|
||||
|
||||
use Test::DBIx::Class;
|
||||
|
||||
my $dir = File::Temp->newdir();
|
||||
my @themes = ('prog', 'test');
|
||||
|
|
|
|||
|
|
@ -40,12 +40,7 @@ sub slurp {
|
|||
return $cont;
|
||||
}
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
connect_opts => { name_sep => '.', quote_char => '`', },
|
||||
fixture_class => '::Populate',
|
||||
}, 'Biblio' ;
|
||||
use Test::DBIx::Class;
|
||||
|
||||
sub fixtures {
|
||||
my ( $data ) = @_;
|
||||
|
|
|
|||
Loading…
Reference in New Issue