Lines 1-27
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
|
|
3 |
# Copyright 2013, 2023 Koha Development team |
4 |
# |
5 |
# This file is part of Koha |
6 |
# |
7 |
# Koha is free software; you can redistribute it and/or modify it |
8 |
# under the terms of the GNU General Public License as published by |
9 |
# the Free Software Foundation; either version 3 of the License, or |
10 |
# (at your option) any later version. |
11 |
# |
12 |
# Koha is distributed in the hope that it will be useful, but |
13 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
# GNU General Public License for more details. |
16 |
# |
17 |
# You should have received a copy of the GNU General Public License |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
3 |
use Modern::Perl; |
20 |
use Modern::Perl; |
|
|
21 |
use Test::More tests => 1; |
22 |
|
23 |
use C4::Context; |
4 |
use C4::Stats qw( UpdateStats ); |
24 |
use C4::Stats qw( UpdateStats ); |
5 |
use Koha::Database; |
25 |
use Koha::Database; |
6 |
|
26 |
|
7 |
use Test::More tests => 19; |
|
|
8 |
|
9 |
BEGIN { |
10 |
use_ok('C4::Stats', qw( UpdateStats )); |
11 |
} |
12 |
can_ok( |
13 |
'C4::Stats', |
14 |
qw(UpdateStats) |
15 |
); |
16 |
|
17 |
my $schema = Koha::Database->new->schema; |
27 |
my $schema = Koha::Database->new->schema; |
18 |
$schema->storage->txn_begin; |
28 |
$schema->storage->txn_begin; |
19 |
my $dbh = C4::Context->dbh; |
29 |
my $dbh = C4::Context->dbh; |
20 |
|
30 |
|
21 |
# |
31 |
subtest 'UpdateStats' => sub { |
22 |
# Test UpdateStats |
32 |
plan tests => 17; |
23 |
# |
|
|
24 |
|
25 |
is (UpdateStats () ,undef, "UpdateStats returns undef if no params"); |
33 |
is (UpdateStats () ,undef, "UpdateStats returns undef if no params"); |
26 |
|
34 |
|
27 |
my $params = { |
35 |
my $params = { |
Lines 161-165
$sth->execute();
Link Here
|
161 |
$line = ${ $sth->fetchall_arrayref( {} ) }[0]; |
169 |
$line = ${ $sth->fetchall_arrayref( {} ) }[0]; |
162 |
is( $line->{location}, undef, |
170 |
is( $line->{location}, undef, |
163 |
"UpdateStats sets location to NULL if undef is passed in." ); |
171 |
"UpdateStats sets location to NULL if undef is passed in." ); |
|
|
172 |
}; |
164 |
|
173 |
|
165 |
# More tests to write! |
174 |
$schema->storage->txn_rollback; |
166 |
- |
|
|