Bugzilla – Attachment 19129 Details for
Bug 10332
UT: CourseReserves.t needs to create its own data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10332: further improvements to course reserves tests
Bug-10332-further-improvements-to-course-reserves-.patch (text/plain), 2.15 KB, created by
Galen Charlton
on 2013-06-18 15:43:47 UTC
(
hide
)
Description:
Bug 10332: further improvements to course reserves tests
Filename:
MIME Type:
Creator:
Galen Charlton
Created:
2013-06-18 15:43:47 UTC
Size:
2.15 KB
patch
obsolete
>From 780dfa534951f2e5124457cbe99c977843e13a18 Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmc@esilibrary.com> >Date: Tue, 18 Jun 2013 08:37:09 -0700 >Subject: [PATCH] Bug 10332: further improvements to course reserves tests > >- Wrap tests in a database transaction; that > way, no special cleanup code is required >- Use AddItem rather than AddItemFromMarc to create > test items; there's no need to build in a > dependence on any particular MARC flavor or > framework in our test cases (except, of course, > for test cases that are explicitly exercising > code that involves the frameworks). > >Signed-off-by: Galen Charlton <gmc@esilibrary.com> >--- > t/db_dependent/CourseReserves.t | 13 +++++++------ > 1 files changed, 7 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/CourseReserves.t b/t/db_dependent/CourseReserves.t >index d122005..ddb6ad9 100755 >--- a/t/db_dependent/CourseReserves.t >+++ b/t/db_dependent/CourseReserves.t >@@ -11,13 +11,17 @@ BEGIN { > use_ok('C4::Biblio'); > use_ok('C4::Context'); > use_ok('C4::CourseReserves', qw/:all/); >- use_ok('C4::Items', qw(AddItemFromMarc)); >+ use_ok('C4::Items', qw(AddItem)); > use_ok('MARC::Field'); > use_ok('MARC::Record'); > } > > my $dbh = C4::Context->dbh; > >+# Start transaction >+$dbh->{AutoCommit} = 0; >+$dbh->{RaiseError} = 1; >+ > my $sth = $dbh->prepare("SELECT * FROM borrowers ORDER BY RAND() LIMIT 10"); > $sth->execute(); > my @borrowers = @{ $sth->fetchall_arrayref( {} ) }; >@@ -28,7 +32,7 @@ $record->append_fields( > MARC::Field->new( '952', '0', '0', a => 'CPL', b => 'CPL' ) > ); > my ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio($record, ''); >-my @iteminfo = C4::Items::AddItemFromMarc( $record, $biblionumber ); >+my @iteminfo = C4::Items::AddItem( { homebranch => 'CPL', holdingbranch => 'CPL' }, $biblionumber ); > my $itemnumber = $iteminfo[2]; > > my $course_id = ModCourse( >@@ -87,7 +91,4 @@ DelCourse($course_id); > $course = GetCourse($course_id); > ok( !defined( $course->{'course_id'} ), "DelCourse deleted course successfully" ); > >-END { >- C4::Items::DelItem( $dbh, $biblionumber, $itemnumber ); >- C4::Biblio::DelBiblio( $biblionumber ); >-}; >+$dbh->rollback; >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10332
:
18382
|
18638
|
18645
|
19058
|
19059
|
19077
|
19078
|
19127
|
19128
|
19129
|
19135