Bug 30870: Don't skip tests if Test::Deep if not installed
We are using Test::Deep in different tests, but from t/db_dependent/Koha.t the tests are skippted if the module is not installed.
We must assume the module is installed
Test plan:
prove t/db_dependent/Koha.t
should return green in ktd
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 42290cb43d
)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
26272432a1
commit
a97d5c93ab
1 changed files with 90 additions and 93 deletions
|
@ -6,6 +6,7 @@
|
|||
use Modern::Perl;
|
||||
use Test::More tests => 5;
|
||||
use Test::Warn;
|
||||
use Test::Deep;
|
||||
|
||||
use t::lib::TestBuilder;
|
||||
|
||||
|
@ -58,101 +59,97 @@ subtest 'Authorized Values Tests' => sub {
|
|||
$sth->execute($data->{category}, $data->{authorised_value}, $data->{lib}, $data->{lib_opac}, $data->{imageurl});
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
eval { require Test::Deep; import Test::Deep; };
|
||||
skip "Test::Deep required to run the GetAuthorisedValues() tests.", 2 if $@;
|
||||
Koha::AuthorisedValueCategory->new({ category_name => 'BUG10656' })->store;
|
||||
Koha::AuthorisedValue->new(
|
||||
{ category => 'BUG10656',
|
||||
authorised_value => 'ZZZ',
|
||||
lib => 'Z_STAFF',
|
||||
lib_opac => 'A_PUBLIC',
|
||||
imageurl => ''
|
||||
}
|
||||
)->store;
|
||||
Koha::AuthorisedValue->new(
|
||||
{ category => 'BUG10656',
|
||||
Koha::AuthorisedValueCategory->new({ category_name => 'BUG10656' })->store;
|
||||
Koha::AuthorisedValue->new(
|
||||
{ category => 'BUG10656',
|
||||
authorised_value => 'ZZZ',
|
||||
lib => 'Z_STAFF',
|
||||
lib_opac => 'A_PUBLIC',
|
||||
imageurl => ''
|
||||
}
|
||||
)->store;
|
||||
Koha::AuthorisedValue->new(
|
||||
{ category => 'BUG10656',
|
||||
authorised_value => 'AAA',
|
||||
lib => 'A_STAFF',
|
||||
lib_opac => 'Z_PUBLIC',
|
||||
imageurl => ''
|
||||
}
|
||||
)->store;
|
||||
|
||||
# the next one sets lib_opac to NULL; in that case, the staff
|
||||
# display value is meant to be used.
|
||||
Koha::AuthorisedValue->new(
|
||||
{ category => 'BUG10656',
|
||||
authorised_value => 'DDD',
|
||||
lib => 'D_STAFF',
|
||||
lib_opac => undef,
|
||||
imageurl => ''
|
||||
}
|
||||
)->store;
|
||||
|
||||
my $authvals = GetAuthorisedValues('BUG10656');
|
||||
cmp_deeply(
|
||||
$authvals,
|
||||
[
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'AAA',
|
||||
lib => 'A_STAFF',
|
||||
lib_opac => 'Z_PUBLIC',
|
||||
imageurl => ''
|
||||
}
|
||||
)->store;
|
||||
|
||||
# the next one sets lib_opac to NULL; in that case, the staff
|
||||
# display value is meant to be used.
|
||||
Koha::AuthorisedValue->new(
|
||||
{ category => 'BUG10656',
|
||||
lib => 'A_STAFF',
|
||||
lib_opac => 'Z_PUBLIC',
|
||||
imageurl => '',
|
||||
},
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'DDD',
|
||||
lib => 'D_STAFF',
|
||||
lib_opac => undef,
|
||||
imageurl => ''
|
||||
}
|
||||
)->store;
|
||||
|
||||
my $authvals = GetAuthorisedValues('BUG10656');
|
||||
cmp_deeply(
|
||||
$authvals,
|
||||
[
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'AAA',
|
||||
lib => 'A_STAFF',
|
||||
lib_opac => 'Z_PUBLIC',
|
||||
imageurl => '',
|
||||
},
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'DDD',
|
||||
lib => 'D_STAFF',
|
||||
lib_opac => undef,
|
||||
imageurl => '',
|
||||
},
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'ZZZ',
|
||||
lib => 'Z_STAFF',
|
||||
lib_opac => 'A_PUBLIC',
|
||||
imageurl => '',
|
||||
},
|
||||
],
|
||||
'list of authorised values in staff mode sorted by staff label (bug 10656)'
|
||||
);
|
||||
$authvals = GetAuthorisedValues('BUG10656', 1);
|
||||
cmp_deeply(
|
||||
$authvals,
|
||||
[
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'ZZZ',
|
||||
lib => 'A_PUBLIC',
|
||||
lib_opac => 'A_PUBLIC',
|
||||
imageurl => '',
|
||||
},
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'DDD',
|
||||
lib => 'D_STAFF',
|
||||
lib_opac => undef,
|
||||
imageurl => '',
|
||||
},
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'AAA',
|
||||
lib => 'Z_PUBLIC',
|
||||
lib_opac => 'Z_PUBLIC',
|
||||
imageurl => '',
|
||||
},
|
||||
],
|
||||
'list of authorised values in OPAC mode sorted by OPAC label (bug 10656)'
|
||||
);
|
||||
}
|
||||
lib => 'D_STAFF',
|
||||
lib_opac => undef,
|
||||
imageurl => '',
|
||||
},
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'ZZZ',
|
||||
lib => 'Z_STAFF',
|
||||
lib_opac => 'A_PUBLIC',
|
||||
imageurl => '',
|
||||
},
|
||||
],
|
||||
'list of authorised values in staff mode sorted by staff label (bug 10656)'
|
||||
);
|
||||
$authvals = GetAuthorisedValues('BUG10656', 1);
|
||||
cmp_deeply(
|
||||
$authvals,
|
||||
[
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'ZZZ',
|
||||
lib => 'A_PUBLIC',
|
||||
lib_opac => 'A_PUBLIC',
|
||||
imageurl => '',
|
||||
},
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'DDD',
|
||||
lib => 'D_STAFF',
|
||||
lib_opac => undef,
|
||||
imageurl => '',
|
||||
},
|
||||
{
|
||||
id => ignore(),
|
||||
category => 'BUG10656',
|
||||
authorised_value => 'AAA',
|
||||
lib => 'Z_PUBLIC',
|
||||
lib_opac => 'Z_PUBLIC',
|
||||
imageurl => '',
|
||||
},
|
||||
],
|
||||
'list of authorised values in OPAC mode sorted by OPAC label (bug 10656)'
|
||||
);
|
||||
|
||||
warning_is { GetAuthorisedValues() } [], 'No warning when no parameter passed to GetAuthorisedValues';
|
||||
|
||||
|
|
Loading…
Reference in a new issue