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 => 21; |
1957 |
plan tests => 24; |
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 1969-1975
subtest 'update_lastseen tests' => sub {
Link Here
|
1969 |
|
1969 |
|
1970 |
t::lib::Mocks::mock_preference( |
1970 |
t::lib::Mocks::mock_preference( |
1971 |
'TrackLastPatronActivityTriggers', |
1971 |
'TrackLastPatronActivityTriggers', |
1972 |
'login,connection,check_in,check_out,renewal,hold' |
1972 |
'login,connection,check_in,check_out,renewal,hold,article' |
1973 |
); |
1973 |
); |
1974 |
|
1974 |
|
1975 |
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' ); |
Lines 2003-2008
subtest 'update_lastseen tests' => sub {
Link Here
|
2003 |
$patron->update_lastseen('hold'); |
2003 |
$patron->update_lastseen('hold'); |
2004 |
$patron->_result()->discard_changes(); |
2004 |
$patron->_result()->discard_changes(); |
2005 |
is( $patron->lastseen, $last_seen, 'Patron last seen should still be unchanged after a hold' ); |
2005 |
is( $patron->lastseen, $last_seen, 'Patron last seen should still be unchanged after a hold' ); |
|
|
2006 |
$patron->update_lastseen('article'); |
2007 |
$patron->_result()->discard_changes(); |
2008 |
is( $patron->lastseen, $last_seen, 'Patron last seen should still be unchanged after a article' ); |
2006 |
|
2009 |
|
2007 |
# Check that tracking is disabled when the activity isn't listed |
2010 |
# Check that tracking is disabled when the activity isn't listed |
2008 |
t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', '' ); |
2011 |
t::lib::Mocks::mock_preference( 'TrackLastPatronActivityTriggers', '' ); |
Lines 2048-2058
subtest 'update_lastseen tests' => sub {
Link Here
|
2048 |
$patron->lastseen, $last_seen, |
2051 |
$patron->lastseen, $last_seen, |
2049 |
'Patron last seen should be unchanged after a hold if hold is not selected as an option and the cache has been cleared' |
2052 |
'Patron last seen should be unchanged after a hold if hold is not selected as an option and the cache has been cleared' |
2050 |
); |
2053 |
); |
|
|
2054 |
$patron->update_lastseen('article'); |
2055 |
$patron->_result()->discard_changes(); |
2056 |
is( |
2057 |
$patron->lastseen, $last_seen, |
2058 |
'Patron last seen should be unchanged after an article request if article is not selected as an option and the cache has been cleared' |
2059 |
); |
2051 |
|
2060 |
|
2052 |
# Check tracking for each activity |
2061 |
# Check tracking for each activity |
2053 |
t::lib::Mocks::mock_preference( |
2062 |
t::lib::Mocks::mock_preference( |
2054 |
'TrackLastPatronActivityTriggers', |
2063 |
'TrackLastPatronActivityTriggers', |
2055 |
'login,connection,check_in,check_out,renewal,hold' |
2064 |
'login,connection,check_in,check_out,renewal,hold,article' |
2056 |
); |
2065 |
); |
2057 |
|
2066 |
|
2058 |
$cache->clear_from_cache($cache_key); |
2067 |
$cache->clear_from_cache($cache_key); |
Lines 2091-2096
subtest 'update_lastseen tests' => sub {
Link Here
|
2091 |
$patron->lastseen, $last_seen, |
2100 |
$patron->lastseen, $last_seen, |
2092 |
'Patron last seen should be changed after a hold if we cleared the cache' |
2101 |
'Patron last seen should be changed after a hold if we cleared the cache' |
2093 |
); |
2102 |
); |
|
|
2103 |
$patron->update_lastseen('article'); |
2104 |
$patron->_result()->discard_changes(); |
2105 |
isnt( |
2106 |
$patron->lastseen, $last_seen, |
2107 |
'Patron last seen should be changed after a article if we cleared the cache' |
2108 |
); |
2094 |
|
2109 |
|
2095 |
$cache->clear_from_cache($cache_key); |
2110 |
$cache->clear_from_cache($cache_key); |
2096 |
$patron->update_lastseen('renewal'); |
2111 |
$patron->update_lastseen('renewal'); |
2097 |
- |
|
|