Bugzilla – Attachment 77358 Details for
Bug 19743
Header and Footer should be updated on each item for checkin / checkout / renewal notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19743: Unit Tests
Bug-19743-Unit-Tests.patch (text/plain), 7.02 KB, created by
Jonathan Druart
on 2018-07-31 20:12:51 UTC
(
hide
)
Description:
Bug 19743: Unit Tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-07-31 20:12:51 UTC
Size:
7.02 KB
patch
obsolete
>From 4f92a227d1dd9c3e003ded0b21d2c244cd375fe6 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 4 Dec 2017 17:43:12 +0000 >Subject: [PATCH] Bug 19743: Unit Tests > >Signed-off-by: Te Rauhina Jackson <terauhina.jackson@gmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Letters/TemplateToolkit.t | 126 ++++++++++++++++++++++++++++++- > 1 file changed, 125 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Letters/TemplateToolkit.t b/t/db_dependent/Letters/TemplateToolkit.t >index a3ee634b51..c4f4e82866 100644 >--- a/t/db_dependent/Letters/TemplateToolkit.t >+++ b/t/db_dependent/Letters/TemplateToolkit.t >@@ -286,7 +286,7 @@ $prepared_letter = GetPreparedLetter( > is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' ); > > subtest 'regression tests' => sub { >- plan tests => 7; >+ plan tests => 8; > > my $library = $builder->build( { source => 'Branch' } ); > my $patron = $builder->build( { source => 'Borrower' } ); >@@ -860,6 +860,130 @@ EOF > is( $tt_letter->{content}, $letter->{content}, ); > }; > >+ subtest 'Bug 19743 - Header and Footer should be updated on each item for checkin / checkout / renewal notices' => sub { >+ plan tests => 8; >+ >+ my $checkout_code = 'CHECKOUT'; >+ my $checkin_code = 'CHECKIN'; >+ >+ my $dbh = C4::Context->dbh; >+ $dbh->do("DELETE FROM letter"); >+ $dbh->do("DELETE FROM issues"); >+ $dbh->do("DELETE FROM message_queue"); >+ >+ # Enable notification for CHECKOUT - Things are hardcoded here but should work with default data >+ $dbh->do(q|INSERT INTO borrower_message_preferences( borrowernumber, message_attribute_id ) VALUES ( ?, ? )|, undef, $patron->{borrowernumber}, 6 ); >+ my $borrower_message_preference_id = $dbh->last_insert_id(undef, undef, "borrower_message_preferences", undef); >+ $dbh->do(q|INSERT INTO borrower_message_transport_preferences( borrower_message_preference_id, message_transport_type) VALUES ( ?, ? )|, undef, $borrower_message_preference_id, 'email' ); >+ # Enable notification for CHECKIN - Things are hardcoded here but should work with default data >+ $dbh->do(q|INSERT INTO borrower_message_preferences( borrowernumber, message_attribute_id ) VALUES ( ?, ? )|, undef, $patron->{borrowernumber}, 5 ); >+ $borrower_message_preference_id = $dbh->last_insert_id(undef, undef, "borrower_message_preferences", undef); >+ $dbh->do(q|INSERT INTO borrower_message_transport_preferences( borrower_message_preference_id, message_transport_type) VALUES ( ?, ? )|, undef, $borrower_message_preference_id, 'email' ); >+ >+ my $checkout_template = q| >+<<branches.branchname>> >+---- >+---- >+|; >+ reset_template( { template => $checkout_template, code => $checkout_code, module => 'circulation' } ); >+ my $checkin_template = q[ >+<<branches.branchname>> >+---- >+---- >+]; >+ reset_template( { template => $checkin_template, code => $checkin_code, module => 'circulation' } ); >+ >+ my $issue = C4::Circulation::AddIssue( $patron, $item1->{barcode} ); >+ my $first_checkout_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; >+ >+ my $library_object = Koha::Libraries->find( $issue->branchcode ); >+ my $old_branchname = $library_object->branchname; >+ my $new_branchname = "Kyle M Hall Memorial Library"; >+ >+ # Change branch name for second checkout notice >+ $library_object->branchname($new_branchname); >+ $library_object->store(); >+ >+ C4::Circulation::AddIssue( $patron, $item2->{barcode} ); >+ my $second_checkout_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; >+ >+ # Restore old name for first checkin notice >+ $library_object->branchname( $old_branchname ); >+ $library_object->store(); >+ >+ AddReturn( $item1->{barcode} ); >+ my $first_checkin_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; >+ >+ # Change branch name for second checkin notice >+ $library_object->branchname($new_branchname); >+ $library_object->store(); >+ >+ AddReturn( $item2->{barcode} ); >+ my $second_checkin_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; >+ >+ # Restore old name for first TT checkout notice >+ $library_object->branchname( $old_branchname ); >+ $library_object->store(); >+ >+ Koha::Notice::Messages->delete; >+ >+ # TT syntax >+ $checkout_template = q| >+[% branch.branchname %] >+---- >+---- >+|; >+ reset_template( { template => $checkout_template, code => $checkout_code, module => 'circulation' } ); >+ $checkin_template = q[ >+[% branch.branchname %] >+---- >+---- >+]; >+ reset_template( { template => $checkin_template, code => $checkin_code, module => 'circulation' } ); >+ >+ C4::Circulation::AddIssue( $patron, $item1->{barcode} ); >+ my $first_checkout_tt_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; >+ >+ # Change branch name for second checkout notice >+ $library_object->branchname($new_branchname); >+ $library_object->store(); >+ >+ C4::Circulation::AddIssue( $patron, $item2->{barcode} ); >+ my $second_checkout_tt_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; >+ >+ # Restore old name for first checkin notice >+ $library_object->branchname( $old_branchname ); >+ $library_object->store(); >+ >+ AddReturn( $item1->{barcode} ); >+ my $first_checkin_tt_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; >+# >+ # Change branch name for second checkin notice >+ $library_object->branchname($new_branchname); >+ $library_object->store(); >+ >+ AddReturn( $item2->{barcode} ); >+ my $second_checkin_tt_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; >+ >+ my $first_letter = qq[ >+$old_branchname >+]; >+ my $second_letter = qq[ >+$new_branchname >+]; >+ >+ >+ is( $first_checkout_letter->content, $first_letter, 'Verify first checkout letter' ); >+ is( $second_checkout_letter->content, $second_letter, 'Verify second checkout letter' ); >+ is( $first_checkin_letter->content, $first_letter, 'Verify first checkin letter' ); >+ is( $second_checkin_letter->content, $second_letter, 'Verify second checkin letter' ); >+ >+ is( $first_checkout_tt_letter->content, $first_letter, 'Verify TT first checkout letter' ); >+ is( $second_checkout_tt_letter->content, $second_letter, 'Verify TT second checkout letter' ); >+ is( $first_checkin_tt_letter->content, $first_letter, 'Verify TT first checkin letter' ); >+ is( $second_checkin_tt_letter->content, $second_letter, 'Verify TT second checkin letter' ); >+ }; >+ > }; > > subtest 'loops' => sub { >-- >2.11.0
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 19743
:
69482
|
69484
|
70533
|
70534
|
77252
|
77253
|
77357
| 77358