Bugzilla – Attachment 173548 Details for
Bug 37522
Logging item modification should record the original version of the item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37522: Unit tests
Bug-37522-Unit-tests.patch (text/plain), 2.51 KB, created by
Martin Renvoize (ashimema)
on 2024-10-28 15:00:26 UTC
(
hide
)
Description:
Bug 37522: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-10-28 15:00:26 UTC
Size:
2.51 KB
patch
obsolete
>From e58e475428ebf091161d3bc7e5d293fd50c5e8de Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Mon, 16 Sep 2024 08:42:11 +0000 >Subject: [PATCH] Bug 37522: Unit tests > >NB, since the 6th argument to logaction is now mandatory for logging item >modifications, one had to modify one line from the previous tests by >adding this additional parameter. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Log.t | 23 +++++++++++++++++++++-- > 1 file changed, 21 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Log.t b/t/db_dependent/Log.t >index 0a1f695ef78..2aaad4bdd07 100755 >--- a/t/db_dependent/Log.t >+++ b/t/db_dependent/Log.t >@@ -16,7 +16,7 @@ > > use Modern::Perl; > use Data::Dumper qw( Dumper ); >-use Test::More tests => 6; >+use Test::More tests => 7; > > use C4::Context; > use C4::Log qw( logaction cronlogaction ); >@@ -177,7 +177,7 @@ subtest 'Reduce log size by unblessing Koha objects' => sub { > is( $logs->count, 1, 'Action found' ); > is( length($logs->next->info), length($str), 'Length exactly identical' ); > >- logaction( 'CATALOGUING', 'MODIFY', $item->itemnumber, $item, 'opac' ); >+ logaction( 'CATALOGUING', 'MODIFY', $item->itemnumber, $item, 'opac', $item ); > $logs = Koha::ActionLogs->search({ module => 'CATALOGUING', action => 'MODIFY', object => $item->itemnumber }); > is( substr($logs->next->info, 0, 5), 'item ', 'Prefix item' ); > is( length($logs->reset->next->info), 5+length($str), 'Length + 5' ); >@@ -218,4 +218,23 @@ subtest 'Test storing diff of objects' => sub { > is( $diff->{D}->{barcode}->{N}, '_MY_TEST_BARCODE_', 'Diff of changes logged successfully' ); > }; > >+subtest 'Test storing original version of an item' => sub { >+ plan tests => 1; >+ >+ $Data::Dumper::Sortkeys = 1; >+ my $builder = t::lib::TestBuilder->new; >+ my $item = $builder->build_sample_item; >+ my $original = $item->get_from_storage; >+ >+ # make sure that $item->...->store logs the update >+ t::lib::Mocks::mock_preference( 'CataloguingLog', 1 ); >+ $item->barcode('_MY_OTHER_BARCODE_')->store(); >+ >+ # update was logged under CATALOGUING / MODIFY so we can retrieve the log now >+ my $log = >+ Koha::ActionLogs->search( { module => 'CATALOGUING', action => 'MODIFY', object => $item->itemnumber } )->next; >+ my $info = $log->info; >+ is( $info, "item " . Dumper( $original->unblessed ), 'Original version of item logged successfully' ); >+}; >+ > $schema->storage->txn_rollback; >-- >2.47.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 37522
:
169855
|
169862
|
171520
|
171566
|
171567
|
173547
| 173548