Bug 15150: Make t/ tests skip if Test::DBIx::Class absent
Tests in t/ should always pass for building the Debian packages for Koha. But we've started using Test::DBIx::Class for writing mocked tests, and that lib is not (yet) packaged fro Debian 7+. This means build is failing. Devs and jenkins use the lib from CPAN. This patch makes the tests skip if the lib is absent. To test: - Install Test::DBIx::Class $ sudo cpanm Test::DBIx::Class - Run the tests: $ prove t/ => SUCCESS: Tests pass - Uninstall Test::DBIx::Class $ sudo cpan -U Test::DBIx::Class - Run the tests: $ prove t/ => SUCCESS: Tests still pass (those needing the lib are skipped) - Sign off :-D Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Works as advertised. All test pass successful Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
6c94dc7987
commit
946cbf71a7
12
t/Biblio.t
12
t/Biblio.t
|
|
@ -17,14 +17,22 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 46;
|
||||
use Test::More;
|
||||
use Test::MockModule;
|
||||
use Test::Warn;
|
||||
|
||||
use Module::Load::Conditional qw/check_install/;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Biblio');
|
||||
if ( check_install( module => 'Test::DBIx::Class' ) ) {
|
||||
plan tests => 46;
|
||||
} else {
|
||||
plan skip_all => "Need Test::DBIx::Class"
|
||||
}
|
||||
}
|
||||
|
||||
use_ok('C4::Biblio');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
|
|
|
|||
40
t/Calendar.t
40
t/Calendar.t
|
|
@ -1,20 +1,42 @@
|
|||
#!/usr/bin/env perl
|
||||
#!/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 <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More;
|
||||
use Test::MockModule;
|
||||
|
||||
use DateTime;
|
||||
use DateTime::Duration;
|
||||
use Test::More tests => 35;
|
||||
use Test::MockModule;
|
||||
use Koha::Cache;
|
||||
use Koha::DateUtils;
|
||||
|
||||
BEGIN {
|
||||
use_ok('Koha::Calendar');
|
||||
use Module::Load::Conditional qw/check_install/;
|
||||
|
||||
# This was the only test C4 had
|
||||
# Remove when no longer used
|
||||
#use_ok('C4::Calendar'); # not used anymore?
|
||||
BEGIN {
|
||||
if ( check_install( module => 'Test::DBIx::Class' ) ) {
|
||||
plan tests => 35;
|
||||
} else {
|
||||
plan skip_all => "Need Test::DBIx::Class"
|
||||
}
|
||||
}
|
||||
|
||||
use_ok('Koha::Calendar');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
|
|
@ -298,3 +320,5 @@ my $day_after_christmas = DateTime->new(
|
|||
'==', 40, 'Test parameter order not relevant (Days)' );
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
30
t/Images.t
30
t/Images.t
|
|
@ -1,11 +1,35 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# This file is part of Koha.
|
||||
#
|
||||
#Testing C4 Images
|
||||
# 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 <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
use Test::More tests => 8;
|
||||
|
||||
use Test::More;
|
||||
use Test::MockModule;
|
||||
|
||||
use Module::Load::Conditional qw/check_install/;
|
||||
|
||||
BEGIN {
|
||||
if ( check_install( module => 'Test::DBIx::Class' ) ) {
|
||||
plan tests => 8;
|
||||
} else {
|
||||
plan skip_all => "Need Test::DBIx::Class"
|
||||
}
|
||||
}
|
||||
|
||||
use_ok('C4::Images');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
|
|
@ -49,3 +73,5 @@ is( $imagenumbers[0], 1, 'imagenumber is 1' );
|
|||
is( $imagenumbers[1], 3, 'imagenumber is 3' );
|
||||
|
||||
is( $imagenumbers[4], undef, 'imagenumber undef' );
|
||||
|
||||
1;
|
||||
|
|
|
|||
30
t/ItemType.t
30
t/ItemType.t
|
|
@ -1,9 +1,35 @@
|
|||
#!/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 <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
use Test::More tests => 25;
|
||||
|
||||
use Test::More;
|
||||
use t::lib::Mocks;
|
||||
|
||||
use Module::Load::Conditional qw/check_install/;
|
||||
|
||||
BEGIN {
|
||||
if ( check_install( module => 'Test::DBIx::Class' ) ) {
|
||||
plan tests => 25;
|
||||
} else {
|
||||
plan skip_all => "Need Test::DBIx::Class"
|
||||
}
|
||||
}
|
||||
|
||||
use_ok('C4::ItemType');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
|
|
@ -90,3 +116,5 @@ is( $itemtype->checkinmsg, 'foo', 'checkinmsg is foo' );
|
|||
|
||||
$itemtype = C4::ItemType->get;
|
||||
is( $itemtype, undef, 'C4::ItemType->get should return unless if no parameter is given' );
|
||||
|
||||
1;
|
||||
|
|
|
|||
12
t/Koha.t
12
t/Koha.t
|
|
@ -18,9 +18,19 @@
|
|||
use Modern::Perl;
|
||||
|
||||
use C4::Context;
|
||||
use Test::More tests => 30;
|
||||
use Test::More;
|
||||
use Test::MockModule;
|
||||
|
||||
use Module::Load::Conditional qw/check_install/;
|
||||
|
||||
BEGIN {
|
||||
if ( check_install( module => 'Test::DBIx::Class' ) ) {
|
||||
plan tests => 30;
|
||||
} else {
|
||||
plan skip_all => "Need Test::DBIx::Class"
|
||||
}
|
||||
}
|
||||
|
||||
use_ok('C4::Koha');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
|
|
|
|||
13
t/Letters.t
13
t/Letters.t
|
|
@ -17,9 +17,18 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use DBI;
|
||||
use Test::MockModule;
|
||||
use Test::More tests => 6;
|
||||
use Test::More;
|
||||
|
||||
use Module::Load::Conditional qw/check_install/;
|
||||
|
||||
BEGIN {
|
||||
if ( check_install( module => 'Test::DBIx::Class' ) ) {
|
||||
plan tests => 6;
|
||||
} else {
|
||||
plan skip_all => "Need Test::DBIx::Class"
|
||||
}
|
||||
}
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
|
|
|
|||
35
t/Matcher.t
35
t/Matcher.t
|
|
@ -1,16 +1,37 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
#testing C4 matcher
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 11;
|
||||
# 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 <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More;
|
||||
use Test::MockModule;
|
||||
|
||||
use Module::Load::Conditional qw/check_install/;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Matcher');
|
||||
if ( check_install( module => 'Test::DBIx::Class' ) ) {
|
||||
plan tests => 11;
|
||||
} else {
|
||||
plan skip_all => "Need Test::DBIx::Class"
|
||||
}
|
||||
}
|
||||
|
||||
use_ok('C4::Matcher');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
|
|
@ -60,3 +81,5 @@ is( $testmatcher->code(), 'match on ISBN', 'testing code accessor' );
|
|||
$testmatcher->description('match on ISSN');
|
||||
|
||||
is( $testmatcher->description(), 'match on ISSN', 'testing code accessor' );
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,37 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Tests 'fetch', 'fake db data', and 'checks for existant attributes'
|
||||
# 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 <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::MockModule;
|
||||
use Test::More tests => 10;
|
||||
use Test::More;
|
||||
|
||||
use Module::Load::Conditional qw/check_install/;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Members::AttributeTypes');
|
||||
if ( check_install( module => 'Test::DBIx::Class' ) ) {
|
||||
plan tests => 10;
|
||||
} else {
|
||||
plan skip_all => "Need Test::DBIx::Class"
|
||||
}
|
||||
}
|
||||
|
||||
use_ok('C4::Members::AttributeTypes');
|
||||
|
||||
use Test::DBIx::Class {
|
||||
schema_class => 'Koha::Schema',
|
||||
connect_info => ['dbi:SQLite:dbname=:memory:','',''],
|
||||
|
|
|
|||
|
|
@ -1,11 +1,35 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# This file is part of Koha.
|
||||
#
|
||||
#Testing C4 SocialData
|
||||
# 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 <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
use Test::More tests => 6;
|
||||
|
||||
use Test::More;
|
||||
use Test::MockModule;
|
||||
|
||||
use Module::Load::Conditional qw/check_install/;
|
||||
|
||||
BEGIN {
|
||||
if ( check_install( module => 'Test::DBIx::Class' ) ) {
|
||||
plan tests => 6;
|
||||
} else {
|
||||
plan skip_all => "Need Test::DBIx::Class"
|
||||
}
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::SocialData');
|
||||
}
|
||||
|
|
@ -51,3 +75,5 @@ is( $report->{'without'}->[0]->{'original'},
|
|||
|
||||
is( $report->{'without'}->[0]->{'isbn'}, '9780596526740',
|
||||
'testing get_report' );
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue