Bugzilla – Attachment 39747 Details for
Bug 14246
Add borrowernumber to koha_news
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated tests in NewsChannels.t
0001-Bug-14246-Update-NewsChannel-tests.patch (text/plain), 3.44 KB, created by
Martin Persson
on 2015-06-01 13:58:11 UTC
(
hide
)
Description:
Updated tests in NewsChannels.t
Filename:
MIME Type:
Creator:
Martin Persson
Created:
2015-06-01 13:58:11 UTC
Size:
3.44 KB
patch
obsolete
>From ea4911dd0a5ff9881664c211c837117ed848bd65 Mon Sep 17 00:00:00 2001 >From: Martin Persson <xarragon@gmail.com> >Date: Mon, 1 Jun 2015 13:56:56 +0200 >Subject: [PATCH] Bug 14246: Update NewsChannel tests > >This commit adds the new 'borrowernumber' field to the existing >test framework to make it pass. It does not include new tests. > >Sponsored-by: Halland County Library >--- > t/db_dependent/NewsChannels.t | 45 ++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 44 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/NewsChannels.t b/t/db_dependent/NewsChannels.t >index f0a86e0..3818dac 100644 >--- a/t/db_dependent/NewsChannels.t >+++ b/t/db_dependent/NewsChannels.t >@@ -3,7 +3,7 @@ > use Modern::Perl; > use C4::Dates qw(format_date); > use C4::Branch qw(GetBranchName); >-use Test::More tests => 10; >+use Test::More tests => 11; > > BEGIN { > use_ok('C4::NewsChannels'); >@@ -22,6 +22,46 @@ if ( !GetBranchName($addbra) ) { > undef, ( $addbra, "$addbra branch" ) ); > } > >+# Add CAT1, if it doesn't exist. >+my $addcat = 'CAT1'; >+{ >+ my $sth = $dbh->prepare( q{ SELECT categorycode FROM categories WHERE categorycode = ? } ); >+ $sth->execute ( $addcat ); >+ if ( not defined $sth->fetchrow () ) { >+ diag("Category $addcat not found, inserting"); >+ $dbh->do( q{ INSERT INTO categories (categorycode,description) VALUES (?,?) }, >+ undef, ( $addcat, "$addcat description") ); >+ } >+} >+ >+# Add a test user if not already present. >+my $addbrwr = 'BRWR1'; >+my $brwrnmbr; >+{ >+ my $query = >+ q{ SELECT borrowernumber from borrowers WHERE surname = ? AND branchcode = ? AND categorycode = ? }; >+ my $sth = $dbh->prepare( $query ); >+ $sth->execute( ($addbrwr, $addbra, $addcat) ); >+ $brwrnmbr = $sth->fetchrow; >+ >+ # Not found, let us insert it. >+ if ( not defined $brwrnmbr ) { >+ diag("Borrower $addbrwr not found, inserting"); >+ $dbh->do( q{ INSERT INTO borrowers (surname, address, city, branchcode, categorycode) VALUES (?, ?, ?, ?, ?) }, >+ undef, ($addbrwr, '(test) address', '(test) city', $addbra, $addcat) ); >+ >+ # Retrieve the njew borrower number. >+ $query = >+ q{ SELECT borrowernumber from borrowers WHERE surname = ? AND branchcode = ? AND categorycode = ? }; >+ my $sth = $dbh->prepare( $query ); >+ $sth->execute( ($addbrwr, $addbra, $addcat) ); >+ $brwrnmbr = $sth->fetchrow; >+ } >+} >+ >+# Must have valid borrower number, or tests are meaningless. >+ok ( defined $brwrnmbr ); >+ > # Test add_opac_new > my $rv = add_opac_new(); # intentionally bad > ok( $rv == 0, 'Correctly failed on no parameter!' ); >@@ -52,6 +92,7 @@ my $href_entry2 = { > expirationdate => $expirationdate2, > timestamp => $timestamp2, > number => $number2, >+ borrowernumber => $brwrnmbr, > branchcode => 'LIB1', > }; > $rv = add_opac_new($href_entry2); >@@ -95,6 +136,7 @@ is_deeply( > expirationdate => $expirationdate1, > timestamp => $timestamp1, > number => $number1, >+ borrowernumber => undef, > idnew => $idnew1, > branchname => "$addbra branch", > branchcode => $addbra, >@@ -117,6 +159,7 @@ is_deeply( > expirationdate => $expirationdate2, > timestamp => $timestamp2, > number => $number2, >+ borrowernumber => $brwrnmbr, > idnew => $idnew2, > branchname => "$addbra branch", > branchcode => $addbra, >-- >2.1.4 >
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 14246
:
39361
|
39413
|
39417
|
39439
|
39521
|
39745
|
39747
|
40125
|
43714
|
43715
|
43716
|
43717
|
43718
|
43719
|
43720
|
43721
|
43722
|
43723
|
43909
|
43910
|
43911
|
43912
|
43913