Bugzilla – Attachment 63617 Details for
Bug 18635
Koha::Patron->guarantees() should return results alphabetically
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18635 - (QA followup) move tests
Bug-18635---QA-followup-move-tests.patch (text/plain), 6.40 KB, created by
Nick Clemens (kidclamp)
on 2017-05-22 14:50:38 UTC
(
hide
)
Description:
Bug 18635 - (QA followup) move tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-05-22 14:50:38 UTC
Size:
6.40 KB
patch
obsolete
>From 854edd04671d8bd8046e76b8893a8f103ab64462 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 22 May 2017 10:49:58 -0400 >Subject: [PATCH] Bug 18635 - (QA followup) move tests > >--- > t/db_dependent/Patron.t | 95 ------------------------------------------------ > t/db_dependent/Patrons.t | 60 +++++++++++++++++++++++++++++- > 2 files changed, 59 insertions(+), 96 deletions(-) > delete mode 100755 t/db_dependent/Patron.t > >diff --git a/t/db_dependent/Patron.t b/t/db_dependent/Patron.t >deleted file mode 100755 >index 146ba96..0000000 >--- a/t/db_dependent/Patron.t >+++ /dev/null >@@ -1,95 +0,0 @@ >-#!/usr/bin/perl >- >-# 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 => 3; >-use Test::Warn; >- >-use C4::Context; >-use Koha::Database; >-use Koha::DateUtils; >- >-use t::lib::TestBuilder; >- >-BEGIN { >- use_ok('Koha::Objects'); >- use_ok('Koha::Patron'); >-} >- >-# Start transaction >-my $database = Koha::Database->new(); >-my $schema = $database->schema(); >- >-subtest 'Patron->guarantees' => sub { >- plan tests => 5; >- >- $schema->storage->txn_begin(); >- >- my $builder = t::lib::TestBuilder->new; >- >- my $categorycode = $builder->build({ source => 'Category' })->{categorycode}; >- my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; >- >- my $guarantor = $builder->build_object( { class => 'Koha::Patrons' } ); >- >- my $guarantee1 = $builder->build_object( { class => 'Koha::Patrons' , value => { >- surname => 'Zebra', >- guarantorid => $guarantor->borrowernumber >- } >- })->borrowernumber; >- >- my $guarantee2 = $builder->build_object( { class => 'Koha::Patrons' , value => { >- surname => 'Yak', >- guarantorid => $guarantor->borrowernumber >- } >- })->borrowernumber; >- >- my $guarantee3 = $builder->build_object( { class => 'Koha::Patrons' , value => { >- surname => 'Xerus', >- firstname => 'Walrus', >- guarantorid => $guarantor->borrowernumber >- } >- })->borrowernumber; >- >- my $guarantee4 = $builder->build_object( { class => 'Koha::Patrons' , value => { >- surname => 'Xerus', >- firstname => 'Vulture', >- guarantorid => $guarantor->borrowernumber >- } >- })->borrowernumber; >- >- my $guarantee5 = $builder->build_object( { class => 'Koha::Patrons' , value => { >- surname => 'Xerus', >- firstname => 'Unicorn', >- guarantorid => $guarantor->borrowernumber >- } >- })->borrowernumber; >- >- my $guarantees = $guarantor->guarantees(); >- >- is( $guarantees->next()->borrowernumber, $guarantee5, "Return first guarantor alphabetically" ); >- is( $guarantees->next()->borrowernumber, $guarantee4, "Return second guarantor alphabetically" ); >- is( $guarantees->next()->borrowernumber, $guarantee3, "Return third guarantor alphabetically" ); >- is( $guarantees->next()->borrowernumber, $guarantee2, "Return fourth guarantor alphabetically" ); >- is( $guarantees->next()->borrowernumber, $guarantee1, "Return fifth guarantor alphabetically" ); >- >- $schema->storage->txn_rollback(); >- >-}; >- >-1; >diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t >index 40f770d..270b0be 100755 >--- a/t/db_dependent/Patrons.t >+++ b/t/db_dependent/Patrons.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 17; >+use Test::More tests => 19; > use Test::Warn; > > use C4::Context; >@@ -29,6 +29,7 @@ use t::lib::TestBuilder; > BEGIN { > use_ok('Koha::Objects'); > use_ok('Koha::Patrons'); >+ use_ok('Koha::Patron'); > } > > # Start transaction >@@ -105,4 +106,61 @@ foreach my $b ( $patrons->as_list() ) { > > $schema->storage->txn_rollback(); > >+subtest 'Patron->guarantees' => sub { >+ plan tests => 5; >+ >+ $schema->storage->txn_begin(); >+ >+ my $builder = t::lib::TestBuilder->new; >+ >+ my $categorycode = $builder->build({ source => 'Category' })->{categorycode}; >+ my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; >+ >+ my $guarantor = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+ my $guarantee1 = $builder->build_object( { class => 'Koha::Patrons' , value => { >+ surname => 'Zebra', >+ guarantorid => $guarantor->borrowernumber >+ } >+ })->borrowernumber; >+ >+ my $guarantee2 = $builder->build_object( { class => 'Koha::Patrons' , value => { >+ surname => 'Yak', >+ guarantorid => $guarantor->borrowernumber >+ } >+ })->borrowernumber; >+ >+ my $guarantee3 = $builder->build_object( { class => 'Koha::Patrons' , value => { >+ surname => 'Xerus', >+ firstname => 'Walrus', >+ guarantorid => $guarantor->borrowernumber >+ } >+ })->borrowernumber; >+ >+ my $guarantee4 = $builder->build_object( { class => 'Koha::Patrons' , value => { >+ surname => 'Xerus', >+ firstname => 'Vulture', >+ guarantorid => $guarantor->borrowernumber >+ } >+ })->borrowernumber; >+ >+ my $guarantee5 = $builder->build_object( { class => 'Koha::Patrons' , value => { >+ surname => 'Xerus', >+ firstname => 'Unicorn', >+ guarantorid => $guarantor->borrowernumber >+ } >+ })->borrowernumber; >+ >+ my $guarantees = $guarantor->guarantees(); >+ >+ is( $guarantees->next()->borrowernumber, $guarantee5, "Return first guarantor alphabetically" ); >+ is( $guarantees->next()->borrowernumber, $guarantee4, "Return second guarantor alphabetically" ); >+ is( $guarantees->next()->borrowernumber, $guarantee3, "Return third guarantor alphabetically" ); >+ is( $guarantees->next()->borrowernumber, $guarantee2, "Return fourth guarantor alphabetically" ); >+ is( $guarantees->next()->borrowernumber, $guarantee1, "Return fifth guarantor alphabetically" ); >+ >+ $schema->storage->txn_rollback(); >+ >+}; >+ > 1; >-- >2.1.4
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 18635
:
63552
|
63553
|
63558
|
63559
|
63617
|
66557
|
66558
|
77005
|
77006
|
77011
|
77012
|
77013
|
77435
|
77436