Bugzilla – Attachment 73863 Details for
Bug 18821
TrackLastPatronActivity is a performance killer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18821 [QA Followup]: Add additional unit tests for completeness
Bug-18821-QA-Followup-Add-additional-unit-tests-fo.patch (text/plain), 3.37 KB, created by
Kyle M Hall (khall)
on 2018-04-09 12:40:14 UTC
(
hide
)
Description:
Bug 18821 [QA Followup]: Add additional unit tests for completeness
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-04-09 12:40:14 UTC
Size:
3.37 KB
patch
obsolete
>From e07a70730ece22e5126493c7014dc9181f62607b Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 6 Apr 2018 02:23:56 +0000 >Subject: [PATCH] Bug 18821 [QA Followup]: Add additional unit tests for > completeness > >--- > t/db_dependent/Members.t | 29 ++++++++++++++++++++++++++--- > 1 file changed, 26 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index aada28bb89..9ce38f97d6 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 62; >+use Test::More tests => 65; > use Test::MockModule; > use Test::Exception; > >@@ -358,6 +358,8 @@ t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '0' ); > Koha::Patrons->find( $patron2->{borrowernumber} )->track_login; > is( Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen, undef, 'Lastseen should not be changed' ); > >+my $session = new CGI::Session( undef, undef, { Directory => File::Spec->tmpdir } ); >+ > Koha::Patrons->find( $patron2->{borrowernumber} )->track_login({ force => 1 }); > my $last_seen = Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen; > isnt( $last_seen, undef, 'Lastseen should be changed now' ); >@@ -365,12 +367,33 @@ isnt( $last_seen, undef, 'Lastseen should be changed now' ); > # Last seen shouldn't be updated a second time for this session > t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '1' ); > Koha::Patrons->find( $patron2->{borrowernumber} )->track_login(); >-is( Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen, $last_seen, 'Lastseen should not be changed' ); >+my $new_lastseen = Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen; >+is( $new_lastseen, $last_seen, 'Lastseen should not be changed' ); > > # If it's forced, it should still be updated > sleep(1); # We need to wait a tiny bit to make sure the timestamp will be different > Koha::Patrons->find( $patron2->{borrowernumber} )->track_login({ force => 1 }); >-isnt( Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen, $last_seen, 'Lastseen should be changed if forced' ); >+$new_lastseen = Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen; >+isnt( $new_lastseen, $last_seen, 'Lastseen should be changed if forced' ); >+ >+# Pass in a session, don't force update, it shouldn't be needed since session is fresh >+sleep(1); >+Koha::Patrons->find( $patron2->{borrowernumber} )->track_login({ session => $session, force => 0 }); >+$new_lastseen = Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen; >+isnt( $new_lastseen, $last_seen, 'Lastseen should be changed if using a fresh session' ); >+ >+# Pass in a session, don't force update, lastseen should be unchanged >+$last_seen = $new_lastseen; >+sleep(1); >+Koha::Patrons->find( $patron2->{borrowernumber} )->track_login({ session => $session, force => 0 }); >+$new_lastseen = Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen; >+is( $new_lastseen, $last_seen, 'Lastseen should be unchanged with existing session' ); >+ >+# Pass in the existing session, force update, lastseen should change >+sleep(1); >+Koha::Patrons->find( $patron2->{borrowernumber} )->track_login({ session => $session, force => 1 }); >+$new_lastseen = Koha::Patrons->find( $patron2->{borrowernumber} )->lastseen; >+isnt( $new_lastseen, $last_seen, 'Lastseen should be changed if forced with existing session' ); > > > # Regression tests for BZ13502 >-- >2.15.1 (Apple Git-101)
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 18821
:
64425
|
64426
|
65687
|
73175
|
73706
|
73863
|
73891
|
73892
|
73893
|
75139
|
75288
|
75289
|
75427
|
75632
|
75633
|
75634
|
75635
|
75727
|
75728
|
75729
|
75733