Bugzilla – Attachment 127234 Details for
Bug 27708
Cannot create EDI order if AcqCreateItem value is not "placing an order"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27708: (QA follow-up) Add a few tests for Koha::Edifact::Order
Bug-27708-QA-follow-up-Add-a-few-tests-for-KohaEdi.patch (text/plain), 4.30 KB, created by
David Nind
on 2021-11-03 09:27:51 UTC
(
hide
)
Description:
Bug 27708: (QA follow-up) Add a few tests for Koha::Edifact::Order
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-11-03 09:27:51 UTC
Size:
4.30 KB
patch
obsolete
>From a65bed2541281210d39467d540e5d63e7af22887 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= <joonas.kylmala@iki.fi> >Date: Tue, 2 Nov 2021 23:22:45 +0000 >Subject: [PATCH] Bug 27708: (QA follow-up) Add a few tests for > Koha::Edifact::Order >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >1. This adds a simple regression test to make sure order_line() method >executes correctly with basket create_items set to "ordering" and >"receiving". > >2. A simple test for the filename method is added > >To test: > 1) prove t/db_dependent/Koha/Edifact/Order.t > >Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/Koha/Edifact/Order.t | 112 ++++++++++++++++++++++++++++ > 1 file changed, 112 insertions(+) > create mode 100755 t/db_dependent/Koha/Edifact/Order.t > >diff --git a/t/db_dependent/Koha/Edifact/Order.t b/t/db_dependent/Koha/Edifact/Order.t >new file mode 100755 >index 0000000000..667e079638 >--- /dev/null >+++ b/t/db_dependent/Koha/Edifact/Order.t >@@ -0,0 +1,112 @@ >+#!/usr/bin/perl >+ >+# Copyright 2021 Joonas Kylmälä <joonas.kylmala@iki.fi> >+# >+# 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 => 2; >+ >+use Koha::Edifact::Order; >+ >+use t::lib::TestBuilder; >+ >+my $schema = Koha::Database->new->schema; >+ >+my $builder = t::lib::TestBuilder->new; >+ >+subtest 'order_line() tests' => sub { >+ # TODO: Split up order_line() to smaller methods in order >+ # to allow better testing >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ my $biblio = $builder->build_sample_biblio(); >+ my $ean = $builder->build( { source => 'EdifactEan' } ); >+ my $order = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => { biblionumber => $biblio->biblionumber } >+ } >+ ); >+ >+ my $vendor = $builder->build( >+ { >+ source => 'VendorEdiAccount', >+ value => { >+ vendor_id => $order->basket->bookseller->id, >+ } >+ } >+ ); >+ >+ my @orders = $schema->resultset('Aqorder') >+ ->search( { basketno => $order->basket->basketno } )->all; >+ >+ my $edi_order = Koha::Edifact::Order->new( >+ { >+ orderlines => \@orders, >+ vendor => $vendor, >+ ean => $ean >+ } >+ ); >+ >+ $order->basket->create_items('ordering')->store; >+ >+ is( $edi_order->order_line( 1, $orders[0] ), >+ undef, 'Orderline message formed with with "ordering"' ); >+ >+ $order->basket->create_items('receiving')->store; >+ >+ is( $edi_order->order_line( 1, $orders[0] ), >+ undef, 'Orderline message formed with "receiving"' ); >+ >+ $schema->storage->txn_rollback; >+}; >+ >+subtest 'filename() tests' => sub { >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $ean = $builder->build( { source => 'EdifactEan' } ); >+ my $order = >+ $builder->build_object( { class => 'Koha::Acquisition::Orders' } ); >+ my $vendor = $builder->build( >+ { >+ source => 'VendorEdiAccount', >+ value => { vendor_id => $order->basket->bookseller->id } >+ } >+ ); >+ >+ my @orders = $schema->resultset('Aqorder') >+ ->search( { basketno => $order->basket->basketno } )->all; >+ >+ my $edi_order = Koha::Edifact::Order->new( >+ { >+ orderlines => \@orders, >+ vendor => $vendor, >+ ean => $ean >+ } >+ ); >+ >+ my $expected_filename = 'ordr' . $order->basket->basketno . '.CEP'; >+ is( $edi_order->filename, $expected_filename, >+ 'Filename is formed from the basket number' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.20.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 27708
:
117453
|
117455
|
117568
|
117665
|
117722
|
117723
|
127227
|
127228
|
127229
|
127233
|
127234
|
127264