Bugzilla – Attachment 95958 Details for
Bug 24149
Add new Koha::Statistic[s] classes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24149: Add tests
Bug-24149-Add-tests.patch (text/plain), 2.43 KB, created by
Jonathan Druart
on 2019-12-03 16:42:03 UTC
(
hide
)
Description:
Bug 24149: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-12-03 16:42:03 UTC
Size:
2.43 KB
patch
obsolete
>From c1d5abe366dfbbb922131ab4febd26d6e41a0632 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 3 Dec 2019 17:40:06 +0100 >Subject: [PATCH] Bug 24149: Add tests > >--- > t/db_dependent/Koha/Statistics.t | 56 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 56 insertions(+) > create mode 100644 t/db_dependent/Koha/Statistics.t > >diff --git a/t/db_dependent/Koha/Statistics.t b/t/db_dependent/Koha/Statistics.t >new file mode 100644 >index 0000000000..00b7438aa4 >--- /dev/null >+++ b/t/db_dependent/Koha/Statistics.t >@@ -0,0 +1,56 @@ >+#!/usr/bin/perl >+ >+# Copyright 2019 Koha Development team >+# >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 4; >+ >+use Koha::Database; >+use Koha::Statistics; >+use C4::Stats; >+ >+use t::lib::TestBuilder; >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+my $builder = t::lib::TestBuilder->new; >+my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+my $item = $builder->build_sample_item; >+my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+C4::Stats::UpdateStats( >+ { >+ type => 'issue', >+ branch => 'BBB', >+ itemnumber => $item->itemnumber, >+ borrowernumber => $patron->borrowernumber, >+ itemtype => $item->effective_itemtype, >+ location => $item->location, >+ } >+); >+ >+my $stat = >+ Koha::Statistics->search( { itemnumber => $item->itemnumber } )->next; >+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' ); >+ >+$schema->storage->txn_rollback; >+ >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24149
:
95956
|
95957
|
95958
|
97239
|
97776
|
97777
|
97778
|
97779
|
97858