Bug 19483: Fix test plan in t/db_dependent/www/*
t/db_dependent/www/* crashes test harness due to misconfigured test plan
prove t/db_dependent/www/
without defining KOHA_INTRANET_URL
bails out and marks the whole test suite as failed.
Test suite should not be failed if this optional WWW::Mechanize test
suite is not activated.
After this patch, the tests are properly skipped without failing the
whole tests.
This is important when running all tests under t, as this needlessly
fails the test suite.
Also handling of 'skip_all' is inconsistent in t/db_dependent/www
-tests, so this normalizes it to skip_all instead of bail_out
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit f25d650a1c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
56f1a54656
commit
862b732c0a
|
|
@ -18,7 +18,7 @@
|
|||
use Modern::Perl;
|
||||
|
||||
use utf8;
|
||||
use Test::More tests => 33;
|
||||
use Test::More; #See plan tests => \d+ below
|
||||
use Test::WWW::Mechanize;
|
||||
use XML::Simple;
|
||||
use JSON;
|
||||
|
|
@ -35,20 +35,22 @@ my $testdir = File::Spec->rel2abs( dirname(__FILE__) );
|
|||
my $koha_conf = $ENV{KOHA_CONF};
|
||||
my $xml = XMLin($koha_conf);
|
||||
|
||||
my $user = $ENV{KOHA_USER} || $xml->{config}->{user};
|
||||
my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass};
|
||||
my $intranet = $ENV{KOHA_INTRANET_URL};
|
||||
|
||||
eval{
|
||||
use C4::Context;
|
||||
};
|
||||
if ($@) {
|
||||
plan skip_all => "Tests skip. You must have a working Context\n";
|
||||
}
|
||||
|
||||
my $user = $ENV{KOHA_USER} || $xml->{config}->{user};
|
||||
my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass};
|
||||
my $intranet = $ENV{KOHA_INTRANET_URL};
|
||||
|
||||
if (not defined $intranet) {
|
||||
elsif (not defined $intranet) {
|
||||
plan skip_all => "Tests skip. You must set env. variable KOHA_INTRANET_URL to do tests\n";
|
||||
}
|
||||
else {
|
||||
plan tests => 33;
|
||||
}
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
use Modern::Perl;
|
||||
|
||||
use utf8;
|
||||
use Test::More tests => 26;
|
||||
use Test::More; #See plan tests => \d+ below
|
||||
use Test::WWW::Mechanize;
|
||||
use XML::Simple;
|
||||
use JSON;
|
||||
|
|
@ -46,10 +46,16 @@ my $user = $ENV{KOHA_USER} || $xml->{config}->{user};
|
|||
my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass};
|
||||
my $intranet = $ENV{KOHA_INTRANET_URL};
|
||||
|
||||
BAIL_OUT("You must set the environment variable KOHA_INTRANET_URL to ".
|
||||
if (not defined $intranet) {
|
||||
plan skip_all =>
|
||||
"You must set the environment variable KOHA_INTRANET_URL to ".
|
||||
"point this test to your staff client. If you do not have ".
|
||||
"KOHA_CONF set, you must also set KOHA_USER and KOHA_PASS for ".
|
||||
"your username and password") unless $intranet;
|
||||
"your username and password";
|
||||
}
|
||||
else {
|
||||
plan tests => 26;
|
||||
}
|
||||
|
||||
$intranet =~ s#/$##;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,26 +21,29 @@ use utf8;
|
|||
use XML::Simple;
|
||||
use Encode;
|
||||
|
||||
use Test::More tests => 4;
|
||||
use Test::More; #See plan tests => \d+ below
|
||||
use Test::WWW::Mechanize;
|
||||
|
||||
my $koha_conf = $ENV{KOHA_CONF};
|
||||
my $xml = XMLin($koha_conf);
|
||||
|
||||
my $user = $ENV{KOHA_USER} || $xml->{config}->{user};
|
||||
my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass};
|
||||
my $intranet = $ENV{KOHA_INTRANET_URL};
|
||||
|
||||
|
||||
eval{
|
||||
use C4::Context;
|
||||
};
|
||||
if ($@) {
|
||||
plan skip_all => "Tests skip. You must have a working Context\n";
|
||||
}
|
||||
|
||||
my $user = $ENV{KOHA_USER} || $xml->{config}->{user};
|
||||
my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass};
|
||||
my $intranet = $ENV{KOHA_INTRANET_URL};
|
||||
|
||||
if (not defined $intranet) {
|
||||
elsif (not defined $intranet) {
|
||||
plan skip_all => "Tests skip. You must set env. variable KOHA_INTRANET_URL to do tests\n";
|
||||
}
|
||||
else {
|
||||
plan tests => 4;
|
||||
}
|
||||
|
||||
|
||||
$intranet =~ s#/$##;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
use Modern::Perl;
|
||||
|
||||
use utf8;
|
||||
use Test::More tests => 66;
|
||||
use Test::More; #See plan tests => \d+ below
|
||||
use Test::WWW::Mechanize;
|
||||
use Data::Dumper;
|
||||
use XML::Simple;
|
||||
|
|
@ -66,9 +66,12 @@ if ( not defined $intranet ) {
|
|||
plan skip_all => "Tests skip. You must set env. variable KOHA_INTRANET_URL to do tests\n";
|
||||
}
|
||||
# test KOHA_OPAC_URL is set
|
||||
if ( not defined $opac ) {
|
||||
elsif ( not defined $opac ) {
|
||||
plan skip_all => "Tests skip. You must set env. variable KOHA_OPAC_URL to do tests\n";
|
||||
}
|
||||
else {
|
||||
plan tests => 66;
|
||||
}
|
||||
|
||||
$intranet =~ s#/$##;
|
||||
$opac =~ s#/$##;
|
||||
|
|
|
|||
Loading…
Reference in New Issue