Lines 21-27
use Modern::Perl;
Link Here
|
21 |
use Test::More tests => 6; |
21 |
use Test::More tests => 6; |
22 |
|
22 |
|
23 |
use C4::Context; |
23 |
use C4::Context; |
24 |
use_ok('C4::Search', qw/AddSearchHistory PurgeSearchHistory/); # GetSearchHistory is not exported |
24 |
use_ok('C4::Search', qw/PurgeSearchHistory/); # GetSearchHistory is not exported |
|
|
25 |
use C4::Search::History; |
25 |
|
26 |
|
26 |
# Start transaction |
27 |
# Start transaction |
27 |
my $dbh = C4::Context->dbh; |
28 |
my $dbh = C4::Context->dbh; |
Lines 36-45
is(_get_history_count(), 0, 'starting off with nothing in search_history');
Link Here
|
36 |
# since the search_history table doesn't have an auto_increment |
37 |
# since the search_history table doesn't have an auto_increment |
37 |
# column, it appears that the value of $dbh->last_insert_id() is |
38 |
# column, it appears that the value of $dbh->last_insert_id() is |
38 |
# useless for determining if the insert failed. |
39 |
# useless for determining if the insert failed. |
39 |
AddSearchHistory(12345, 'session_1', 'query_desc_1', 'query_cgi_1', 5); |
40 |
C4::Search::History::add({userid => 12345, sessionid => 'session_1', query_desc => 'query_desc_1', query_cgi => 'query_cgi_1', total => 5}); |
40 |
AddSearchHistory(12345, 'session_1', 'query_desc_2', 'query_cgi_2', 6); |
41 |
C4::Search::History::add({userid => 12345, sessionid => 'session_1', query_desc => 'query_desc_2', query_cgi => 'query_cgi_3', total => 6}); |
41 |
AddSearchHistory(12345, 'session_1', 'query_desc_3', 'query_cgi_3', 7); |
42 |
C4::Search::History::add({userid => 12345, sessionid => 'session_1', query_desc => 'query_desc_3', query_cgi => 'query_cgi_3', total => 7}); |
42 |
AddSearchHistory(56789, 'session_2', 'query_desc_4', 'query_cgi_4', 8); |
43 |
C4::Search::History::add({userid => 56789, sessionid => 'session_2', query_desc => 'query_desc_4', query_cgi => 'query_cgi_4', total => 8}); |
43 |
is(_get_history_count(), 4, 'successfully added four search_history rows'); |
44 |
is(_get_history_count(), 4, 'successfully added four search_history rows'); |
44 |
|
45 |
|
45 |
# We're not testing GetSearchHistory at present because it is broken... |
46 |
# We're not testing GetSearchHistory at present because it is broken... |
46 |
- |
|
|