Bugzilla – Attachment 57431 Details for
Bug 17558
Fix t/db_dependent/Koha/Patron/Messages.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF]Bug 17558: Add more tests
SIGNED-OFFBug-17558-Add-more-tests.patch (text/plain), 2.51 KB, created by
Héctor Eduardo Castro Avalos
on 2016-11-10 16:56:33 UTC
(
hide
)
Description:
[SIGNED-OFF]Bug 17558: Add more tests
Filename:
MIME Type:
Creator:
Héctor Eduardo Castro Avalos
Created:
2016-11-10 16:56:33 UTC
Size:
2.51 KB
patch
obsolete
>From d3f8ce79ef33f69c428bf537ff4f63c2931bebdd Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Tue, 25 Oct 2016 21:50:43 +0000 >Subject: [PATCH] [SIGNED-OFF]Bug 17558: Add more tests > >Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> >All tests pass successfuly >--- > t/db_dependent/Koha/Patron/Messages.t | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patron/Messages.t b/t/db_dependent/Koha/Patron/Messages.t >index eb14a53..27164e4 100644 >--- a/t/db_dependent/Koha/Patron/Messages.t >+++ b/t/db_dependent/Koha/Patron/Messages.t >@@ -19,12 +19,13 @@ > > use Modern::Perl; > >-use Test::More tests => 9; >+use Test::More tests => 11; > > use C4::Context; > use C4::Log; > use Koha::Patron::Message; > use Koha::Patron::Messages; >+use Koha::Patrons; > use Koha::Database; > > use t::lib::Mocks; >@@ -36,6 +37,7 @@ $schema->storage->txn_begin; > my $builder = t::lib::TestBuilder->new; > my $library = $builder->build( { source => 'Branch' } ); > my $patron = $builder->build( { source => 'Borrower', values => { branchcode => $library->{branchcode} } } ); >+my $patron_2 = Koha::Patrons->search->next; > my $nb_of_logaction = get_nb_of_logactions(); > my $nb_of_messages = Koha::Patron::Messages->search->count; > >@@ -49,6 +51,13 @@ my $new_message_1 = Koha::Patron::Message->new( > )->store; > is( get_nb_of_logactions(), $nb_of_logaction, 'With BorrowersLog off, no new log should have been added' ); > >+my $context = new Test::MockModule('C4::Context'); >+$context->mock( 'userenv', sub { >+ return { >+ number => $patron_2->{borrowernumber}, >+ }; >+}); >+ > t::lib::Mocks::mock_preference('BorrowersLog', 1); > my $new_message_2 = Koha::Patron::Message->new( > { borrowernumber => $patron->{borrowernumber}, >@@ -64,6 +73,9 @@ is( Koha::Patron::Messages->search->count, $nb_of_messages + 2, 'The 2 messages > > my $retrieved_message_1 = Koha::Patron::Messages->find( $new_message_1->message_id ); > is( $retrieved_message_1->message, $new_message_1->message, 'Find a message by id should return the correct message' ); >+is( $retrieved_message_1->manager_id, undef, 'Manager id should not be filled in when it is not defined in userenv' ); >+my $retrieved_message_2 = Koha::Patron::Messages->find( $new_message_2->message_id ); >+is( $retrieved_message_2->manager_id, $patron_2->{borrowernumber}, 'Manager id should be filled in when it is defined in userenv' ); > > t::lib::Mocks::mock_preference('BorrowersLog', 0); > $retrieved_message_1->delete; >-- >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 17558
:
57222
|
57223
|
57430
|
57431
|
57455
|
57456
|
57457
|
57458
|
57459