Bugzilla – Attachment 41886 Details for
Bug 14719
Regression tests for members/statistics.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14719 - Regression tests for members/statistics.pl
Bug-14719---Regression-tests-for-membersstatistics.patch (text/plain), 3.71 KB, created by
Olli-Antti Kivilahti
on 2015-08-25 09:03:29 UTC
(
hide
)
Description:
Bug 14719 - Regression tests for members/statistics.pl
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2015-08-25 09:03:29 UTC
Size:
3.71 KB
patch
obsolete
>From a4054d3330602289877dfaa71e7d5833197fe503 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Tue, 25 Aug 2015 11:55:29 +0300 >Subject: [PATCH] Bug 14719 - Regression tests for members/statistics.pl > >Run perl t/db_dependent/Members/statistics.t > >Depends on PageObject tests and TestObjectFactories. >--- > t/db_dependent/Members/statistics.t | 77 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 77 insertions(+) > create mode 100644 t/db_dependent/Members/statistics.t > >diff --git a/t/db_dependent/Members/statistics.t b/t/db_dependent/Members/statistics.t >new file mode 100644 >index 0000000..8c2ad59 >--- /dev/null >+++ b/t/db_dependent/Members/statistics.t >@@ -0,0 +1,77 @@ >+#!/usr/bin/perl >+ >+# Copyright 2015 Open Source Freedom Fighters >+# >+# 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; >+use Try::Tiny; #Even Selenium::Remote::Driver uses Try::Tiny :) >+use Scalar::Util qw(blessed); >+ >+use t::lib::Page::Members::Statistics; >+use t::lib::TestObjects::BorrowerFactory; >+use t::lib::TestObjects::CheckoutFactory; >+use Koha::Auth::PermissionManager; >+ >+$ENV{KOHA_PAGEOBJECT_DEBUG} = 1; >+ >+subtest "Show Borrower Statistics" => \&showBorrowerStatistics; >+sub showBorrowerStatistics { >+ ##Setting up the test context >+ my $subtestContext = {}; >+ >+ eval { #run in a eval-block so we don't die without tearing down the test context >+ ##Create the test Borrower >+ my $password = '1234'; >+ my $borrowerFactory = t::lib::TestObjects::BorrowerFactory->new(); >+ my $borrowers = $borrowerFactory->createTestGroup( >+ {cardnumber => '1A01', >+ branchcode => 'CPL', >+ userid => 'mini_admin', >+ password => $password, >+ }, >+ , undef, $subtestContext); >+ my $permissionManager = Koha::Auth::PermissionManager->new(); >+ $permissionManager->grantPermissions($borrowers->{'1A01'}, {borrowers => 'view_borrowers',}); >+ >+ ##Test context set, starting testing: >+ my $statistics = t::lib::Page::Members::Statistics->new({borrowernumber => $borrowers->{'1A01'}->borrowernumber}); >+ $statistics->doPasswordLogin($borrowers->{'1A01'}->userid, $password)->isStatisticsRows([]); #We shouldn't have any statistics >+ >+ ##Checkout two Items >+ my $checkouts = t::lib::TestObjects::CheckoutFactory->createTestGroup( >+ [ {barcode => 'Item021T', >+ cardnumber => '1A01', >+ }, >+ {barcode => 'Item022T', >+ cardnumber => '1A01', >+ }, >+ ], >+ undef, $subtestContext); >+ >+ ##We should have one statistics row. >+ $statistics->refresh()->isStatisticsRows([{todaysCheckouts => 2}]); >+ >+ }; >+ if ($@) { #Catch all leaking errors and gracefully terminate. >+ warn $@; >+ } >+ t::lib::TestObjects::ObjectFactory->tearDownTestContext($subtestContext); >+} >+ >+done_testing; >-- >1.9.1
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 14719
: 41886