Bug 20996: (follow-up) Fix test
- Fixes the t/db_dependent/Illrequest/Config.t - Adds tests for Koha::Illrequest::Config->has_branch 0) Do not apply the path 1) Run test t/db_dependent/Illrequest/Config.t 2) It fails - it is because the Koha/Illrequest/Config.pm prefixes handling changed 3) Apply the patch 4) Run test again, it should pass now 5) Read through the test code and confirm it makes sense Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
1a0172a253
commit
5b807fd3d7
1 changed files with 9 additions and 10 deletions
|
@ -410,7 +410,7 @@ subtest '_load_configuration' => sub {
|
||||||
|
|
||||||
subtest 'Final tests' => sub {
|
subtest 'Final tests' => sub {
|
||||||
|
|
||||||
plan tests => 10;
|
plan tests => 9;
|
||||||
|
|
||||||
$schema->storage->txn_begin;
|
$schema->storage->txn_begin;
|
||||||
|
|
||||||
|
@ -419,12 +419,11 @@ subtest 'Final tests' => sub {
|
||||||
my $config = Koha::Illrequest::Config->new;
|
my $config = Koha::Illrequest::Config->new;
|
||||||
|
|
||||||
# getPrefixes (error & undef):
|
# getPrefixes (error & undef):
|
||||||
dies_ok( sub { $config->getPrefixes("FOO") }, "getPrefixes: die if not correct type.");
|
is($config->getPrefixes(), undef,
|
||||||
is_deeply($config->getPrefixes("brw_cat"), { default => undef},
|
|
||||||
"getPrefixes: Undefined brw_cat prefix is undefined.");
|
|
||||||
is_deeply($config->getPrefixes("branch"), { default => undef},
|
|
||||||
"getPrefixes: Undefined branch prefix is undefined.");
|
"getPrefixes: Undefined branch prefix is undefined.");
|
||||||
|
|
||||||
|
is($config->has_branch(), undef, "Config does not have branch when no config loaded");
|
||||||
|
|
||||||
# getDigitalRecipients (error & undef):
|
# getDigitalRecipients (error & undef):
|
||||||
dies_ok( sub { $config->getDigitalRecipients("FOO") },
|
dies_ok( sub { $config->getDigitalRecipients("FOO") },
|
||||||
"getDigitalRecipients: die if not correct type.");
|
"getDigitalRecipients: die if not correct type.");
|
||||||
|
@ -449,11 +448,8 @@ subtest 'Final tests' => sub {
|
||||||
);
|
);
|
||||||
|
|
||||||
# getPrefixes (values):
|
# getPrefixes (values):
|
||||||
is_deeply($config->getPrefixes("brw_cat"),
|
is_deeply($config->getPrefixes(),
|
||||||
{ B => '2-prefix', default => 'DEFAULT-prefix' },
|
{ '1' => 'T-prefix' },
|
||||||
"getPrefixes: return configuration brw_cat prefixes.");
|
|
||||||
is_deeply($config->getPrefixes("branch"),
|
|
||||||
{ 1 => 'T-prefix', default => 'DEFAULT-prefix' },
|
|
||||||
"getPrefixes: return configuration branch prefixes.");
|
"getPrefixes: return configuration branch prefixes.");
|
||||||
|
|
||||||
# getDigitalRecipients (values):
|
# getDigitalRecipients (values):
|
||||||
|
@ -464,6 +460,9 @@ subtest 'Final tests' => sub {
|
||||||
{ 2 => 'borrower', default => 'branch' },
|
{ 2 => 'borrower', default => 'branch' },
|
||||||
"getDigitalRecipients: return branch digital_recipients.");
|
"getDigitalRecipients: return branch digital_recipients.");
|
||||||
|
|
||||||
|
# has_branch test
|
||||||
|
ok($config->has_branch(), "has_branch returns true if branch defined in configuration");
|
||||||
|
|
||||||
$schema->storage->txn_rollback;
|
$schema->storage->txn_rollback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue