Bugzilla – Attachment 105534 Details for
Bug 25670
Add useful methods to Koha::Acquisition::Orders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25670: Unit tests
Bug-25670-Unit-tests.patch (text/plain), 3.07 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-06-03 20:05:56 UTC
(
hide
)
Description:
Bug 25670: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-06-03 20:05:56 UTC
Size:
3.07 KB
patch
obsolete
>From 580cf84a6f89241c6e81d233e71198d2bb99776f Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 3 Jun 2020 16:58:25 -0300 >Subject: [PATCH] Bug 25670: Unit tests > >--- > t/db_dependent/Koha/Acquisition/Orders.t | 73 ++++++++++++++++++++++++ > 1 file changed, 73 insertions(+) > create mode 100644 t/db_dependent/Koha/Acquisition/Orders.t > >diff --git a/t/db_dependent/Koha/Acquisition/Orders.t b/t/db_dependent/Koha/Acquisition/Orders.t >new file mode 100644 >index 00000000000..f4024c2ded2 >--- /dev/null >+++ b/t/db_dependent/Koha/Acquisition/Orders.t >@@ -0,0 +1,73 @@ >+#!/usr/bin/perl >+ >+# Copyright 2020 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 => 1; >+use Test::Exception; >+ >+use t::lib::TestBuilder; >+use t::lib::Mocks; >+ >+use Koha::Database; >+ >+my $schema = Koha::Database->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+subtest 'filter_by_id_including_transfers() tets' => sub { >+ >+ plan tests => 6; >+ >+ $schema->storage->txn_begin; >+ >+ my $order_1 = $builder->build_object({ class => 'Koha::Acquisition::Orders' }); >+ my $order_2 = $builder->build_object({ class => 'Koha::Acquisition::Orders' }); >+ my $order_3 = $builder->build_object({ class => 'Koha::Acquisition::Orders' }); >+ >+ $builder->build( >+ { >+ source => 'AqordersTransfer', >+ value => { >+ ordernumber_from => $order_1->ordernumber, >+ ordernumber_to => $order_2->ordernumber >+ } >+ } >+ ); >+ >+ my $orders_rs = Koha::Acquisition::Orders->search; >+ my $count = $orders_rs->count; >+ >+ throws_ok >+ { $orders_rs->filter_by_id_including_transfers() } >+ 'Koha::Exceptions::MissingParameter', >+ 'Exception thrown correctly'; >+ >+ $orders_rs = $orders_rs->filter_by_id_including_transfers({ ordernumber => $order_1->ordernumber }); >+ >+ is( $orders_rs->count, 2, 'The two referenced orders are returned' ); >+ is( $orders_rs->next->ordernumber, $order_1->ordernumber, 'The right order is returned' ); >+ is( $orders_rs->next->ordernumber, $order_2->ordernumber, 'The right order is returned' ); >+ >+ $orders_rs = $orders_rs->filter_by_id_including_transfers({ ordernumber => $order_2->ordernumber }); >+ >+ is( $orders_rs->count, 1, 'Only one order related to the specified ordernumber' ); >+ is( $orders_rs->next->ordernumber, $order_2->ordernumber, 'The right order is returned' ); >+ >+ $schema->storage->txn_rollback; >+} >-- >2.26.2
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 25670
:
105534
|
105535
|
109859
|
109860
|
110643
|
110644
|
110700
|
110701
|
114940
|
114941
|
116141