Bug 18242: [SOLUTION 2]Add tests
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
parent
95f4c19769
commit
48b1328ebe
1 changed files with 27 additions and 1 deletions
|
@ -17,7 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 3;
|
||||
use Test::More tests => 4;
|
||||
use Test::MockModule;
|
||||
use Test::Warn;
|
||||
|
||||
|
@ -262,4 +262,30 @@ subtest "AddReturn logging on statistics table (item-level_itypes=0)" => sub {
|
|||
"biblio-level itype recorded on statistics for return");
|
||||
};
|
||||
|
||||
subtest 'Handle ids duplication' => sub {
|
||||
plan tests => 1;
|
||||
|
||||
my $biblio = $builder->build( { source => 'Biblio' } );
|
||||
my $item = $builder->build(
|
||||
{
|
||||
source => 'Item',
|
||||
value => {
|
||||
biblionumber => $biblio->{biblionumber},
|
||||
notforloan => 0,
|
||||
itemlost => 0,
|
||||
withdrawn => 0,
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
my $patron = $builder->build({source => 'Borrower'});
|
||||
|
||||
my $checkout = AddIssue( $patron, $item->{barcode} );
|
||||
$builder->build({ source => 'OldIssue', value => { issue_id => $checkout->issue_id } });
|
||||
|
||||
my @a = AddReturn( $item->{barcode} );
|
||||
my $old_checkout = Koha::Old::Checkouts->find( $checkout->issue_id );
|
||||
isnt( $old_checkout->itemnumber, $item->{itemnumber}, 'If an item is checked-in, it should be moved to old_issues even if the issue_id already existed in the table' );
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
Loading…
Reference in a new issue