Bug 17716: Remove itemtype-related t/db_dependent/CourseReserves.t

This patch makes t/db_dependent/CourseReserves.t create
good sample data for its tests. It does so by creating a random
itemtype.

To test:
- Run
  $ prove t/db_dependent/CourseReserves.t
=> FAIL: lots of warnings about "item-level_itypes set but no itemtype
  set for item"
- Apply the patch
- Run:
  $ prove t/db_dependent/CourseReserves.t
=> SUCCESS: Tests are green, and no warnings.
- Sign off :-D

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Tomas Cohen Arazi 2016-12-02 15:21:58 -03:00 committed by Kyle M Hall
parent b74d045435
commit c275cf490f
1 changed files with 10 additions and 4 deletions

View File

@ -25,9 +25,9 @@ my $builder = t::lib::TestBuilder->new;
my $dbh = C4::Context->dbh;
$dbh->{RaiseError} = 1;
my $library = $builder->build({
source => 'Branch',
});
my $library = $builder->build( { source => 'Branch' } );
my $itemtype = $builder->build(
{ source => 'Itemtype', value => { notforloan => undef } } )->{itemtype};
my $sth = $dbh->prepare("SELECT * FROM borrowers ORDER BY RAND() LIMIT 10");
$sth->execute();
@ -39,7 +39,13 @@ $record->append_fields(
MARC::Field->new( '952', '0', '0', a => $library->{branchcode}, b => $library->{branchcode} )
);
my ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio($record, '');
my @iteminfo = C4::Items::AddItem( { homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode} }, $biblionumber );
my @iteminfo = C4::Items::AddItem(
{ homebranch => $library->{branchcode},
holdingbranch => $library->{branchcode},
itype => $itemtype
},
$biblionumber
);
my $itemnumber = $iteminfo[2];
my $course_id = ModCourse(