Bugzilla – Attachment 43539 Details for
Bug 14247
System preference for news author display
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14246: Update NewsChannel tests
Bug-14246-Update-NewsChannel-tests.patch (text/plain), 3.63 KB, created by
Marc Véron
on 2015-10-16 18:43:56 UTC
(
hide
)
Description:
Bug 14246: Update NewsChannel tests
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-10-16 18:43:56 UTC
Size:
3.63 KB
patch
obsolete
>From bbed3bf3bac6a6784b3146db7a4626fbb1763b19 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 >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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 > >Signed-off-by: Marc Véron <veron@veron.ch> > >http://bugs.koha-community.org/show_bug.cgi?id=14247 >--- > 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, >-- >1.7.10.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 14247
:
39362
|
39414
|
39418
|
39440
|
39488
|
39527
|
43093
|
43538
|
43539
|
43540
|
43541
|
43542
|
43543
|
43724
|
43725
|
43914
|
43915