|
Lines 1954-1960
subtest 'alert_subscriptions tests' => sub {
Link Here
|
| 1954 |
|
1954 |
|
| 1955 |
subtest 'update_lastseen tests' => sub { |
1955 |
subtest 'update_lastseen tests' => sub { |
| 1956 |
|
1956 |
|
| 1957 |
plan tests => 18; |
1957 |
plan tests => 21; |
| 1958 |
$schema->storage->txn_begin; |
1958 |
$schema->storage->txn_begin; |
| 1959 |
|
1959 |
|
| 1960 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
1960 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
|
Lines 1967-1973
subtest 'update_lastseen tests' => sub {
Link Here
|
| 1967 |
my $cache_key = "track_activity_" . $patron->borrowernumber; |
1967 |
my $cache_key = "track_activity_" . $patron->borrowernumber; |
| 1968 |
$cache->clear_from_cache($cache_key); |
1968 |
$cache->clear_from_cache($cache_key); |
| 1969 |
|
1969 |
|
| 1970 |
t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'login,connection,check_in,check_out,renewal' ); |
1970 |
t::lib::Mocks::mock_preference( |
|
|
1971 |
'TrackLastPatronActivityTriggers', |
| 1972 |
'login,connection,check_in,check_out,renewal,article' |
| 1973 |
); |
| 1971 |
|
1974 |
|
| 1972 |
is( $patron->lastseen, undef, 'Patron should have not last seen when newly created' ); |
1975 |
is( $patron->lastseen, undef, 'Patron should have not last seen when newly created' ); |
| 1973 |
|
1976 |
|
|
Lines 1997-2002
subtest 'update_lastseen tests' => sub {
Link Here
|
| 1997 |
$patron->update_lastseen('renewal'); |
2000 |
$patron->update_lastseen('renewal'); |
| 1998 |
$patron->_result()->discard_changes(); |
2001 |
$patron->_result()->discard_changes(); |
| 1999 |
is( $patron->lastseen, $last_seen, 'Patron last seen should still be unchanged after a renewal' ); |
2002 |
is( $patron->lastseen, $last_seen, 'Patron last seen should still be unchanged after a renewal' ); |
|
|
2003 |
$patron->update_lastseen('article'); |
| 2004 |
$patron->_result()->discard_changes(); |
| 2005 |
is( $patron->lastseen, $last_seen, 'Patron last seen should still be unchanged after a article' ); |
| 2000 |
|
2006 |
|
| 2001 |
# Check that tracking is disabled when the activity isn't listed |
2007 |
# Check that tracking is disabled when the activity isn't listed |
| 2002 |
t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', '' ); |
2008 |
t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', '' ); |
|
Lines 2036-2044
subtest 'update_lastseen tests' => sub {
Link Here
|
| 2036 |
$patron->lastseen, $last_seen, |
2042 |
$patron->lastseen, $last_seen, |
| 2037 |
'Patron last seen should be unchanged after a renewal if renewal is not selected as an option and the cache has been cleared' |
2043 |
'Patron last seen should be unchanged after a renewal if renewal is not selected as an option and the cache has been cleared' |
| 2038 |
); |
2044 |
); |
|
|
2045 |
$patron->update_lastseen('article'); |
| 2046 |
$patron->_result()->discard_changes(); |
| 2047 |
is( |
| 2048 |
$patron->lastseen, $last_seen, |
| 2049 |
'Patron last seen should be unchanged after an article request if article is not selected as an option and the cache has been cleared' |
| 2050 |
); |
| 2039 |
|
2051 |
|
| 2040 |
# Check tracking for each activity |
2052 |
# Check tracking for each activity |
| 2041 |
t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', 'login,connection,check_in,check_out,renewal' ); |
2053 |
t::lib::Mocks::mock_preference( |
|
|
2054 |
'TrackLastPatronActivityTriggers', |
| 2055 |
'login,connection,check_in,check_out,renewal,article' |
| 2056 |
); |
| 2042 |
|
2057 |
|
| 2043 |
$cache->clear_from_cache($cache_key); |
2058 |
$cache->clear_from_cache($cache_key); |
| 2044 |
$patron->update_lastseen('login'); |
2059 |
$patron->update_lastseen('login'); |
|
Lines 2069-2074
subtest 'update_lastseen tests' => sub {
Link Here
|
| 2069 |
'Patron last seen should be changed after a check_in if we cleared the cache' |
2084 |
'Patron last seen should be changed after a check_in if we cleared the cache' |
| 2070 |
); |
2085 |
); |
| 2071 |
|
2086 |
|
|
|
2087 |
$cache->clear_from_cache($cache_key); |
| 2088 |
$patron->update_lastseen('article'); |
| 2089 |
$patron->_result()->discard_changes(); |
| 2090 |
isnt( |
| 2091 |
$patron->lastseen, $last_seen, |
| 2092 |
'Patron last seen should be changed after a article if we cleared the cache' |
| 2093 |
); |
| 2094 |
|
| 2072 |
$cache->clear_from_cache($cache_key); |
2095 |
$cache->clear_from_cache($cache_key); |
| 2073 |
$patron->update_lastseen('renewal'); |
2096 |
$patron->update_lastseen('renewal'); |
| 2074 |
$patron->_result()->discard_changes(); |
2097 |
$patron->_result()->discard_changes(); |
| 2075 |
- |
|
|