Bug 30144: (QA follow-up) Fix t/Ediorder.t for JSON servicing_instruction format
Bug 30144 changed Koha::Edifact::Order::gir_segments() to expect servicing_instruction as a JSON-encoded array of instruction groups (added by Bug 41709 while working with the older plain-string format that predated Bug 30144's change was never adapted to match). As a plain string no longer decodes as JSON, gir_segments() silently skipped the servicing instruction elements, leaving the GIR split and special-character tests comparing against undef. Test plan: 1. prove t/Ediorder.t => 4 tests failed before this patch, all pass after 2. prove t/db_dependent/Koha/Edifact/Order.t => still passes Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
58cda28f6a
commit
b210605ef7
|
|
@ -3,6 +3,8 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use FindBin qw( $Bin );
|
use FindBin qw( $Bin );
|
||||||
|
|
||||||
|
use JSON qw( encode_json );
|
||||||
|
|
||||||
use Test::NoWarnings;
|
use Test::NoWarnings;
|
||||||
use Test::More tests => 16;
|
use Test::More tests => 16;
|
||||||
use t::lib::Mocks;
|
use t::lib::Mocks;
|
||||||
|
|
@ -119,7 +121,7 @@ cmp_ok(
|
||||||
'Single Gir field OK'
|
'Single Gir field OK'
|
||||||
);
|
);
|
||||||
|
|
||||||
$orderfields->{servicing_instruction} = 'S_I';
|
$orderfields->{servicing_instruction} = encode_json( [ [ { type => 'LVT', value => 'S_I' } ] ] );
|
||||||
@gsegs = Koha::Edifact::Order::gir_segments(
|
@gsegs = Koha::Edifact::Order::gir_segments(
|
||||||
{
|
{
|
||||||
ol_fields => $orderfields,
|
ol_fields => $orderfields,
|
||||||
|
|
@ -140,7 +142,7 @@ cmp_ok(
|
||||||
# Test that special characters are properly escaped in GIR segments
|
# Test that special characters are properly escaped in GIR segments
|
||||||
my $special_orderfields = {
|
my $special_orderfields = {
|
||||||
budget_code => 'BUDGET?+',
|
budget_code => 'BUDGET?+',
|
||||||
servicing_instruction => "Note with 'special' chars:",
|
servicing_instruction => encode_json( [ [ { type => 'LVT', value => "Note with 'special' chars:" } ] ] ),
|
||||||
};
|
};
|
||||||
my @special_items = (
|
my @special_items = (
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue