Bug 24441: Add tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
367df45840
commit
3760af11f7
1 changed files with 31 additions and 1 deletions
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
use Modern::Perl;
|
use Modern::Perl;
|
||||||
|
|
||||||
use Test::More tests => 5;
|
use Test::More tests => 6;
|
||||||
use Test::MockModule;
|
use Test::MockModule;
|
||||||
use Test::Warn;
|
use Test::Warn;
|
||||||
|
|
||||||
|
@ -364,4 +364,34 @@ subtest 'Checkin of an item claimed as returned should generate a message' => su
|
||||||
ok( $messages->{ReturnClaims}, "ReturnClaims is in messages for return of a claimed as returned itm" );
|
ok( $messages->{ReturnClaims}, "ReturnClaims is in messages for return of a claimed as returned itm" );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
subtest 'BranchTransferLimitsType' => sub {
|
||||||
|
plan tests => 2;
|
||||||
|
|
||||||
|
t::lib::Mocks::mock_preference('AutomaticItemReturn', 0);
|
||||||
|
t::lib::Mocks::mock_preference('UseBranchTransferLimits', 1);
|
||||||
|
t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'ccode');
|
||||||
|
|
||||||
|
my $biblio = $builder->build_object( { class => 'Koha::Biblios' } );
|
||||||
|
my $item = $builder->build_object(
|
||||||
|
{
|
||||||
|
class => 'Koha::Items',
|
||||||
|
value => {
|
||||||
|
biblionumber => $biblio->biblionumber,
|
||||||
|
notforloan => 0,
|
||||||
|
itemlost => 0,
|
||||||
|
withdrawn => 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
my $patron = $builder->build_object({class => 'Koha::Patrons'});
|
||||||
|
my $checkout = AddIssue( $patron->unblessed, $item->barcode );
|
||||||
|
my ( $doreturn, $messages, $issue ) = AddReturn($item->barcode);
|
||||||
|
is( $doreturn, 1, 'AddReturn should have checkin the item if BranchTransferLimitsType=ccode');
|
||||||
|
|
||||||
|
t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype');
|
||||||
|
$checkout = AddIssue( $patron->unblessed, $item->barcode );
|
||||||
|
( $doreturn, $messages, $issue ) = AddReturn($item->barcode);
|
||||||
|
is( $doreturn, 1, 'AddReturn should have checkin the item if BranchTransferLimitsType=itemtype');
|
||||||
|
};
|
||||||
|
|
||||||
$schema->storage->txn_rollback;
|
$schema->storage->txn_rollback;
|
||||||
|
|
Loading…
Reference in a new issue