From 546d1de81be8c07982c54e6da60190faa2092e33 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 3 Feb 2023 23:22:20 +0000 Subject: [PATCH] Bug 30928: Add tests prove -v t/db_dependent/Koha/Statistics.t prove -v t/db_dependent/Stats.t --- t/db_dependent/Koha/Statistics.t | 5 ++++- t/db_dependent/Stats.t | 13 +++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/t/db_dependent/Koha/Statistics.t b/t/db_dependent/Koha/Statistics.t index 01600fa3484..d3f8a76c80e 100755 --- a/t/db_dependent/Koha/Statistics.t +++ b/t/db_dependent/Koha/Statistics.t @@ -19,10 +19,11 @@ use Modern::Perl; -use Test::More tests => 4; +use Test::More tests => 5; use Koha::Database; use Koha::Statistics; +use C4::Context; use C4::Stats qw( UpdateStats ); use t::lib::TestBuilder; @@ -43,6 +44,7 @@ C4::Stats::UpdateStats( itemtype => $item->effective_itemtype, location => $item->location, ccode => $item->ccode, + interface => C4::Context->interface } ); @@ -52,5 +54,6 @@ is( $stat->borrowernumber, $patron->borrowernumber, 'Patron is there' ); is( $stat->branch, $library->branchcode, 'Library is there' ); is( ref( $stat->item ), 'Koha::Item', '->item returns a Koha::Item object' ); is( $stat->item->itemnumber, $item->itemnumber, '->item works great' ); +is( $stat->interface, 'opac', 'Interface is recorded successfully' ); $schema->storage->txn_rollback; diff --git a/t/db_dependent/Stats.t b/t/db_dependent/Stats.t index ce411905c5e..117dfbea281 100755 --- a/t/db_dependent/Stats.t +++ b/t/db_dependent/Stats.t @@ -4,7 +4,7 @@ use Modern::Perl; use C4::Stats qw( UpdateStats ); use Koha::Database; -use Test::More tests => 18; +use Test::More tests => 19; BEGIN { use_ok('C4::Stats', qw( UpdateStats )); @@ -33,6 +33,7 @@ my $params = { itemtype => "BK", location => "LOC", ccode => "CODE", + interface => "INTERFACE", }; my $return_error; @@ -105,7 +106,8 @@ $params = { itemtype => "BK", location => "LOC", ccode => "CODE", - type => "return" + type => "return", + interface => "INTERFACE", }; UpdateStats ($params); my $sth = $dbh->prepare("SELECT * FROM statistics"); @@ -119,6 +121,7 @@ is ($params->{other}, $line->{other}, "UpdateStats save other is ($params->{itemtype}, $line->{itemtype}, "UpdateStats save itemtype param in itemtype field of statistics table"); is ($params->{location}, $line->{location}, "UpdateStats save location param in location field of statistics table"); is ($params->{ccode}, $line->{ccode}, "UpdateStats save ccode param in ccode field of statistics table"); +is ($params->{interface}, $line->{interface}, "UpdateStats save interface param in interface field of statistics table"); $dbh->do(q|DELETE FROM statistics|); $params = { @@ -129,7 +132,8 @@ $params = { other => "bla", itemtype => "BK", ccode => "CODE", - type => "return" + type => "return", + interface => "INTERFACE", }; UpdateStats($params); $sth = $dbh->prepare("SELECT * FROM statistics"); @@ -148,7 +152,8 @@ $params = { itemtype => "BK", location => undef, ccode => "CODE", - type => "return" + type => "return", + interface => "interface" }; UpdateStats($params); $sth = $dbh->prepare("SELECT * FROM statistics"); -- 2.30.2