Bug 17603: Remove itemtype-related Borrower_Discharge.t warnings
This patch makes t/db_dependent/Patron/Borrower_Discharge.t create good sample data for its tests. It does so by creating a random itemtype. To test: - Run $ prove t/db_dependent/Patron/Borrower_Discharge.t => FAIL: lots of warnings about "item-level_itypes set but no itemtype set for item" - Apply the patch - Run: $ prove t/db_dependent/Patron/Borrower_Discharge.t => SUCCESS: Tests are green, and no warnings. - Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Mason James <mtj@kohaaloha.com>
This commit is contained in:
parent
78ae5d237e
commit
faa9b66a72
|
|
@ -38,12 +38,9 @@ my $builder = t::lib::TestBuilder->new;
|
|||
my $dbh = C4::Context->dbh;
|
||||
$dbh->do(q|DELETE FROM discharges|);
|
||||
|
||||
my $library = $builder->build({
|
||||
source => 'Branch',
|
||||
});
|
||||
my $another_library = $builder->build({
|
||||
source => 'Branch',
|
||||
});
|
||||
my $library = $builder->build({ source => 'Branch' });
|
||||
my $another_library = $builder->build({ source => 'Branch' });
|
||||
my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype};
|
||||
|
||||
C4::Context->_new_userenv('xxx');
|
||||
C4::Context->set_userenv(0, 0, 0, 'firstname', 'surname', $library->{branchcode}, $library->{branchcode}, '', '', '', '', '');
|
||||
|
|
@ -69,7 +66,15 @@ my $patron3 = $builder->build({
|
|||
# Discharge not possible with issues
|
||||
my ( $biblionumber ) = AddBiblio( MARC::Record->new, '');
|
||||
my $barcode = 'BARCODE42';
|
||||
my ( undef, undef, $itemnumber ) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, barcode => $barcode }, $biblionumber);
|
||||
my ( undef, undef, $itemnumber ) = AddItem(
|
||||
{ homebranch => $library->{branchcode},
|
||||
holdingbranch => $library->{branchcode},
|
||||
barcode => $barcode,
|
||||
itype => $itemtype
|
||||
},
|
||||
$biblionumber
|
||||
);
|
||||
|
||||
AddIssue( $patron, $barcode );
|
||||
is( Koha::Patron::Discharge::can_be_discharged({ borrowernumber => $patron->{borrowernumber} }), 0, 'A patron with issues cannot be discharged' );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue