Lines 2-13
Link Here
|
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
|
4 |
|
5 |
use Test::More tests => 25; |
5 |
use Test::More tests => 26; |
6 |
use Test::Warn; |
6 |
use Test::Warn; |
7 |
use URI::Escape; |
7 |
use URI::Escape; |
8 |
use List::Util qw( shuffle ); |
8 |
use List::Util qw( shuffle ); |
9 |
|
9 |
|
10 |
use C4::Context; |
10 |
use C4::Context; |
|
|
11 |
use Koha::DateUtils; |
11 |
my $dbh = C4::Context->dbh; |
12 |
my $dbh = C4::Context->dbh; |
12 |
$dbh->{AutoCommit} = 0; |
13 |
$dbh->{AutoCommit} = 0; |
13 |
$dbh->{RaiseError} = 1; |
14 |
$dbh->{RaiseError} = 1; |
Lines 197-202
C4::Search::History::delete({
Link Here
|
197 |
$all = C4::Search::History::get({userid => $userid}); |
198 |
$all = C4::Search::History::get({userid => $userid}); |
198 |
is( scalar(@$all), 0, 'There is no search after calling delete with an interval = -1 days' ); |
199 |
is( scalar(@$all), 0, 'There is no search after calling delete with an interval = -1 days' ); |
199 |
|
200 |
|
|
|
201 |
# If time is null, it must be set to NOW() |
202 |
my $query_desc_b1_p = q{first previous biblio search}; |
203 |
C4::Search::History::add( { |
204 |
userid => $userid, |
205 |
sessionid => $previous_sessionid, |
206 |
query_desc => $query_desc_b1_p, |
207 |
query_cgi => $query_cgi_b, |
208 |
total => $total, |
209 |
type => 'biblio', |
210 |
}); |
211 |
my $search_history_id = $dbh->last_insert_id( undef, undef, 'search_history', undef ); |
212 |
my $search_history = C4::Search::History::get({ id => $search_history_id }); |
213 |
is( output_pref({ dt => dt_from_string($search_history->[0]->{time}), dateonly => 1 }), output_pref({ dt => dt_from_string, dateonly => 1 }), "Inserting a new search history should handle undefined time" ); |
214 |
|
215 |
|
200 |
delete_all( $userid ); |
216 |
delete_all( $userid ); |
201 |
|
217 |
|
202 |
sub add { |
218 |
sub add { |
203 |
- |
|
|