Lines 4-10
use Modern::Perl;
Link Here
|
4 |
use C4::Stats qw( UpdateStats ); |
4 |
use C4::Stats qw( UpdateStats ); |
5 |
use Koha::Database; |
5 |
use Koha::Database; |
6 |
|
6 |
|
7 |
use Test::More tests => 18; |
7 |
use Test::More tests => 19; |
8 |
|
8 |
|
9 |
BEGIN { |
9 |
BEGIN { |
10 |
use_ok('C4::Stats', qw( UpdateStats )); |
10 |
use_ok('C4::Stats', qw( UpdateStats )); |
Lines 33-38
my $params = {
Link Here
|
33 |
itemtype => "BK", |
33 |
itemtype => "BK", |
34 |
location => "LOC", |
34 |
location => "LOC", |
35 |
ccode => "CODE", |
35 |
ccode => "CODE", |
|
|
36 |
interface => "INTERFACE", |
36 |
}; |
37 |
}; |
37 |
my $return_error; |
38 |
my $return_error; |
38 |
|
39 |
|
Lines 105-111
$params = {
Link Here
|
105 |
itemtype => "BK", |
106 |
itemtype => "BK", |
106 |
location => "LOC", |
107 |
location => "LOC", |
107 |
ccode => "CODE", |
108 |
ccode => "CODE", |
108 |
type => "return" |
109 |
type => "return", |
|
|
110 |
interface => "INTERFACE", |
109 |
}; |
111 |
}; |
110 |
UpdateStats ($params); |
112 |
UpdateStats ($params); |
111 |
my $sth = $dbh->prepare("SELECT * FROM statistics"); |
113 |
my $sth = $dbh->prepare("SELECT * FROM statistics"); |
Lines 119-124
is ($params->{other}, $line->{other}, "UpdateStats save other
Link Here
|
119 |
is ($params->{itemtype}, $line->{itemtype}, "UpdateStats save itemtype param in itemtype field of statistics table"); |
121 |
is ($params->{itemtype}, $line->{itemtype}, "UpdateStats save itemtype param in itemtype field of statistics table"); |
120 |
is ($params->{location}, $line->{location}, "UpdateStats save location param in location field of statistics table"); |
122 |
is ($params->{location}, $line->{location}, "UpdateStats save location param in location field of statistics table"); |
121 |
is ($params->{ccode}, $line->{ccode}, "UpdateStats save ccode param in ccode field of statistics table"); |
123 |
is ($params->{ccode}, $line->{ccode}, "UpdateStats save ccode param in ccode field of statistics table"); |
|
|
124 |
is ($params->{interface}, $line->{interface}, "UpdateStats save interface param in interface field of statistics table"); |
122 |
|
125 |
|
123 |
$dbh->do(q|DELETE FROM statistics|); |
126 |
$dbh->do(q|DELETE FROM statistics|); |
124 |
$params = { |
127 |
$params = { |
Lines 129-135
$params = {
Link Here
|
129 |
other => "bla", |
132 |
other => "bla", |
130 |
itemtype => "BK", |
133 |
itemtype => "BK", |
131 |
ccode => "CODE", |
134 |
ccode => "CODE", |
132 |
type => "return" |
135 |
type => "return", |
|
|
136 |
interface => "INTERFACE", |
133 |
}; |
137 |
}; |
134 |
UpdateStats($params); |
138 |
UpdateStats($params); |
135 |
$sth = $dbh->prepare("SELECT * FROM statistics"); |
139 |
$sth = $dbh->prepare("SELECT * FROM statistics"); |
Lines 148-154
$params = {
Link Here
|
148 |
itemtype => "BK", |
152 |
itemtype => "BK", |
149 |
location => undef, |
153 |
location => undef, |
150 |
ccode => "CODE", |
154 |
ccode => "CODE", |
151 |
type => "return" |
155 |
type => "return", |
|
|
156 |
interface => "interface" |
152 |
}; |
157 |
}; |
153 |
UpdateStats($params); |
158 |
UpdateStats($params); |
154 |
$sth = $dbh->prepare("SELECT * FROM statistics"); |
159 |
$sth = $dbh->prepare("SELECT * FROM statistics"); |
155 |
- |
|
|