Bugzilla – Attachment 130028 Details for
Bug 26704
Koha::Item store triggers should utilise Koha::Object::Messages for message passing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26704: Unit tests
Bug-26704-Unit-tests.patch (text/plain), 2.55 KB, created by
Katrin Fischer
on 2022-01-31 22:29:22 UTC
(
hide
)
Description:
Bug 26704: Unit tests
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-01-31 22:29:22 UTC
Size:
2.55 KB
patch
obsolete
>From 5d2f72da81ed432dbcd609e0086b4861e0934f45 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 29 Nov 2021 15:18:21 -0300 >Subject: [PATCH] Bug 26704: Unit tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Koha/Item.t | 59 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 58 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 0139cd40af..ac47d8fd48 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -20,7 +20,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 13; >+use Test::More tests => 14; > use Test::Exception; > > use C4::Biblio qw( GetMarcSubfieldStructure ); >@@ -1167,3 +1167,60 @@ subtest 'columns_to_str' => sub { > $schema->storage->txn_rollback; > > }; >+ >+subtest 'store() tests' => sub { >+ >+ plan tests => 1; >+ >+ subtest '_set_found_trigger() tests' => sub { >+ >+ plan tests => 6; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $item = $builder->build_sample_item({ itemlost => 1, itemlost_on => dt_from_string() }); >+ >+ # Add a lost item debit >+ my $debit = $patron->account->add_debit( >+ { >+ amount => 10, >+ type => 'LOST', >+ item_id => $item->id, >+ interface => 'intranet', >+ } >+ ); >+ >+ my $lostreturn_policy = 'charge'; >+ >+ my $mocked_circ_rules = Test::MockModule->new('Koha::CirculationRules'); >+ $mocked_circ_rules->mock( 'get_lostreturn_policy', sub { return $lostreturn_policy; } ); >+ >+ # simulate it was found >+ $item->set( { itemlost => 0 } )->store; >+ >+ my $messages = $item->messages; >+ >+ my $message_1 = $messages->[0]; >+ >+ is( $message_1->type, 'info', 'type is correct' ); >+ is( $message_1->message, 'lost_refunded', 'message is correct' ); >+ >+ # Find the refund credit >+ my $credit = $debit->credits->next; >+ >+ is_deeply( >+ $message_1->payload, >+ { credit_id => $credit->id }, >+ 'type is correct' >+ ); >+ >+ my $message_2 = $messages->[1]; >+ >+ is( $message_2->type, 'info', 'type is correct' ); >+ is( $message_2->message, 'lost_charge', 'message is correct' ); >+ is( $message_2->payload, undef, 'no payload' ); >+ >+ $schema->storage->txn_rollback; >+ }; >+}; >-- >2.30.2
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 26704
:
118548
|
122004
|
128070
|
128084
|
128085
|
130027
|
130028
|
130484
|
130485
|
130486
|
130657
|
130658