Bugzilla – Attachment 68242 Details for
Bug 19483
t/db_dependent/www/* crashes test harness due to misconfigured test plan
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19483 - t/db_dependent/www/* crashes test harness due to misconfigured test plan
Bug-19483---tdbdependentwww-crashes-test-harness-d.patch (text/plain), 5.10 KB, created by
Olli-Antti Kivilahti
on 2017-10-18 11:36:28 UTC
(
hide
)
Description:
Bug 19483 - t/db_dependent/www/* crashes test harness due to misconfigured test plan
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2017-10-18 11:36:28 UTC
Size:
5.10 KB
patch
obsolete
>From ecc6c4982429798a68afa00fc78e7cd8673956ef Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Wed, 18 Oct 2017 14:33:22 +0300 >Subject: [PATCH] Bug 19483 - 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 >--- > t/db_dependent/www/auth_values_input_www.t | 16 +++++++++------- > t/db_dependent/www/batch.t | 12 +++++++++--- > t/db_dependent/www/history.t | 17 ++++++++++------- > t/db_dependent/www/search_utf8.t | 7 +++++-- > 4 files changed, 33 insertions(+), 19 deletions(-) > >diff --git a/t/db_dependent/www/auth_values_input_www.t b/t/db_dependent/www/auth_values_input_www.t >index 265865c..1d96a14 100644 >--- a/t/db_dependent/www/auth_values_input_www.t >+++ b/t/db_dependent/www/auth_values_input_www.t >@@ -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; >@@ -33,20 +33,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; > >diff --git a/t/db_dependent/www/batch.t b/t/db_dependent/www/batch.t >index 30d9886..f822454 100644 >--- a/t/db_dependent/www/batch.t >+++ b/t/db_dependent/www/batch.t >@@ -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#/$##; > >diff --git a/t/db_dependent/www/history.t b/t/db_dependent/www/history.t >index b71f7b6..9d1ba49 100644 >--- a/t/db_dependent/www/history.t >+++ b/t/db_dependent/www/history.t >@@ -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#/$##; >diff --git a/t/db_dependent/www/search_utf8.t b/t/db_dependent/www/search_utf8.t >index c0d3a27..869b4eb 100644 >--- a/t/db_dependent/www/search_utf8.t >+++ b/t/db_dependent/www/search_utf8.t >@@ -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#/$##; >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19483
:
68242
|
68307
|
70468