Bugzilla – Attachment 64987 Details for
Bug 18613
Deleting a Letter from a library as superlibrarian deletes the "All libraries" rule
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18613: Add unit tests for getletter
Bug-18613-Add-unit-tests-for-getletter.patch (text/plain), 4.00 KB, created by
Baptiste Wojtkowski (bwoj)
on 2017-07-11 09:13:25 UTC
(
hide
)
Description:
Bug 18613: Add unit tests for getletter
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2017-07-11 09:13:25 UTC
Size:
4.00 KB
patch
obsolete
>From bc2a3b7a64c1161aea45bc732dcc1f4d6c9e918a Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Date: Tue, 11 Jul 2017 09:12:37 +0000 >Subject: [PATCH] Bug 18613: Add unit tests for getletter > >--- > t/db_dependent/Letters.t | 45 +++++++++++++++++++++++++++++++++++---------- > 1 file changed, 35 insertions(+), 10 deletions(-) > >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index 7950750..39c3a52 100644 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -18,7 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 82; >+use Test::More tests => 75; > use Test::MockModule; > use Test::Warn; > >@@ -182,15 +182,38 @@ is( $letters->[0]->{name}, 'my name', 'GetLetters gets the name correctly' ); > > > # getletter >-my $letter = C4::Letters::getletter('my module', 'my code', $library->{branchcode}, 'email'); >-is( $letter->{branchcode}, $library->{branchcode}, 'GetLetters gets the branch code correctly' ); >-is( $letter->{module}, 'my module', 'GetLetters gets the module correctly' ); >-is( $letter->{code}, 'my code', 'GetLetters gets the code correctly' ); >-is( $letter->{name}, 'my name', 'GetLetters gets the name correctly' ); >-is( $letter->{is_html}, 1, 'GetLetters gets the boolean is_html correctly' ); >-is( $letter->{title}, $title, 'GetLetters gets the title correctly' ); >-is( $letter->{content}, $content, 'GetLetters gets the content correctly' ); >-is( $letter->{message_transport_type}, 'email', 'GetLetters gets the message type correctly' ); >+subtest 'getletter' => sub { >+ plan tests => 16; >+ my $letter = C4::Letters::getletter('my module', 'my code', $library->{branchcode}, 'email'); >+ is( $letter->{branchcode}, $library->{branchcode}, 'GetLetters gets the branch code correctly' ); >+ is( $letter->{module}, 'my module', 'GetLetters gets the module correctly' ); >+ is( $letter->{code}, 'my code', 'GetLetters gets the code correctly' ); >+ is( $letter->{name}, 'my name', 'GetLetters gets the name correctly' ); >+ is( $letter->{is_html}, 1, 'GetLetters gets the boolean is_html correctly' ); >+ is( $letter->{title}, $title, 'GetLetters gets the title correctly' ); >+ is( $letter->{content}, $content, 'GetLetters gets the content correctly' ); >+ is( $letter->{message_transport_type}, 'email', 'GetLetters gets the message type correctly' ); >+ >+ my $context = Test::MockModule->new('C4::Context'); >+ $context->mock( 'userenv', sub { >+ return { branch => "anotherlib" } >+ }); >+ >+ t::lib::Mocks::mock_preference('IndependentBranches', 1); >+ $letter = C4::Letters::getletter('my module', 'my code', $library->{branchcode}, 'email'); >+ is( $letter->{branchcode}, $library->{branchcode}, 'GetLetters gets the branch code correctly' ); >+ is( $letter->{module}, 'my module', 'GetLetters gets the module correctly' ); >+ is( $letter->{code}, 'my code', 'GetLetters gets the code correctly' ); >+ is( $letter->{name}, 'my name', 'GetLetters gets the name correctly' ); >+ is( $letter->{is_html}, 1, 'GetLetters gets the boolean is_html correctly' ); >+ is( $letter->{title}, $title, 'GetLetters gets the title correctly' ); >+ is( $letter->{content}, $content, 'GetLetters gets the content correctly' ); >+ is( $letter->{message_transport_type}, 'email', 'GetLetters gets the message type correctly' ); >+ >+ $context->unmock('userenv'); >+}; >+ >+ > > # Regression test for Bug 14206 > $dbh->do( q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES ('FFL','my module','my code','my name',1,?,?,'print')|, undef, $title, $content ); >@@ -199,6 +222,8 @@ is( $letter14206_a->{message_transport_type}, 'print', 'Bug 14206 - message_tran > my $letter14206_b = C4::Letters::getletter('my module', 'my code', 'FFL', 'print'); > is( $letter14206_b->{message_transport_type}, 'print', 'Bug 14206 - message_transport_type passed, correct mtt detected' ); > >+ >+ > # test for overdue_notices.pl > my $overdue_rules = { > letter1 => 'my code', >-- >2.7.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 18613
:
63484
|
63485
|
63486
|
63578
|
64616
|
64912
|
64914
| 64987