Business-EDI
view release on metacpan or search on metacpan
t/002-Spec-analysis.t view on Meta::CPAN
}
use vars qw/%code_hash $slurp $perl/;
my $debug = $Business::EDI::debug = $Business::EDI::Spec::debug = @ARGV ? shift : 0;
my $edi = Business::EDI->new('d08a') or die "Business::EDI->new('d08a') failed";
ok($perl = ordrsp_data, "DATA handle read and decode" );
$perl or die "DATA handle not decoded successfully";
# note("ref(\$obj): " . ref($perl));
# note(" \$obj : " . $perl );
$Data::Dumper::Indent = 1;
ok($perl->{body}, "EDI interchange body");
ok($perl->{body}->[0], "EDI interchange body is a populated arrayref!");
is(scalar(@{$perl->{body}}), 3, "EDI interchange body has 3 messages");
is($edi->spec->syntax, 40100, "\$edi->spec->syntax");
t/002-Spec.t view on Meta::CPAN
}
use vars qw/%code_hash $parser $slurp $perl/;
my $debug = $Business::EDI::debug = $Business::EDI::Spec::debug = @ARGV ? shift : 0;
my $edi = Business::EDI->new('d08a') or die "Business::EDI->new('d08a') failed";
ok($perl = ordrsp_data, "DATA handle read and decode" );
$perl or die "DATA handle not decoded successfully";
# note("ref(\$obj): " . ref($perl));
# note(" \$obj : " . $perl );
$Data::Dumper::Indent = 1;
ok($perl->{body}, "EDI interchange body");
ok($perl->{body}->[0], "EDI interchange body is a populated arrayref!");
is(scalar(@{$perl->{body}}), 3, "EDI interchange body has 3 messages");
is($edi->spec->syntax, 40100, "\$edi->spec->syntax");
t/002a-Spec-for-Segment_group.t view on Meta::CPAN
use_ok('Business::EDI::Test', qw/ordrsp_data/);
}
use vars qw/$perl/;
my $debug = $Business::EDI::debug = $Business::EDI::Spec::debug = @ARGV ? shift : 0;
my $edi = Business::EDI->new('d08a') or die "Business::EDI->new('d08a') failed";
ok($perl = ordrsp_data, "DATA handle read and decode" );
$perl or die "DATA handle not decoded successfully";
$Data::Dumper::Indent = 1;
is(scalar(@{$perl->{body}}), 3, "EDI interchange body has 3 messages");
my $msgcode = 'ORDRSP';
my $spec = $edi->spec->get_spec('message');
ok($spec,"\$edi->spec->get_spec('message')");
ok($spec->{$msgcode}, "\$edi->spec->get_spec('message')->{$msgcode}");
#print "Dump of ORDRSP spec: ", Dumper($spec->{ORDRSP});
t/020-Message-ORDRSP.t view on Meta::CPAN
# print Dumper($segbody); exit;
push @lins, \@chunks;
} else {
# note("EDI: ignoring segment '$tag'");
}
}
return @lins;
}
ok($perl = ordrsp_data(), "DATA handle read and decode" );
$perl or die "DATA handle not read and decoded successfully";
$Data::Dumper::Indent = 1;
ok($perl->{body}, "EDI interchange body");
ok($perl->{body}->[0], "EDI interchange body is a populated arrayref!");
is(scalar(@{$perl->{body}}), 3, "EDI interchange body has 3 messages");
my @li = ();
my $i = 0;
foreach my $part (@{$perl->{body}}) {
t/021-Message-ORDRSP-xpath.t view on Meta::CPAN
is($ordrsp->xpath_value('UNH/S009/0051'), 'UN', "self->xpath_value('UNH/S009/0051')");
is($ordrsp->xpath_value('UNH/S009/0052'), 'D', "self->xpath_value('UNH/S009/0052')");
is($ordrsp->xpath_value('UNH/S009/0065'), 'ORDRSP', "self->xpath_value('UNH/S009/0065')");
is($ordrsp->xpath_value('UNH/S009/0054'), '96A', "self->xpath_value('UNH/S009/0054')");
# print Dumper($ordrsp->xpath('UNH/S009/0065'));
# $debug and $debug > 1 and print Dumper $ordrsp;
}
ok($perl = ordrsp_data(), "DATA handle read and decode" );
$perl or die "DATA handle not read and decoded successfully";
$Data::Dumper::Indent = 1;
my $i = 0;
# We only have the data mapped out for the first message, so the other two use "basic" tests
foreach my $part (@{$perl->{body}}) {
foreach my $key (keys %$part) {
next unless ok($key eq 'ORDRSP', "EDI interchange message type == ORDRSP");
parse_ordrsp($part->{$key}, $i);
t/022-Message-ORDRSP-all_accessor.t view on Meta::CPAN
sub parse_ordrsp {
my ($top_nodes) = @_;
my $type = 'ORDRSP';
my $ordrsp;
ok($ordrsp = $edi->detect_version($top_nodes), "EDI $type object via \$edi->detect_version");
my @sg26 = $ordrsp->all_SG26;
is(scalar(@sg26), 18, "\$ordrsp->all_SG26 returns 18 SG26 objects");
}
ok($perl = ordrsp_data(), "DATA handle read and decode" );
$perl or die "DATA handle not read and decoded successfully";
$Data::Dumper::Indent = 1;
foreach my $part (shift @{$perl->{body}}) { # just do the first one
foreach my $key (keys %$part) {
next unless ok($key eq 'ORDRSP', "EDI interchange message type == ORDRSP");
parse_ordrsp($part->{$key});
}
}
t/999-data.t view on Meta::CPAN
}
# ELSE: return vivified non-class hashes, all arrays, and anything that isn't a hash or array ref
return $obj;
}
ok($slurp = join('', <DATA>), "Slurped data from DATA handle");
my $foo = ($parser->decode($slurp));
ok($foo, "decode slurp");
ok($perl = JSONObject2Perl($foo), "DATA handle read and decode" );
$perl or die "DATA handle not decoded successfully";
# note("ref(\$obj): " . ref($perl));
# note(" \$obj : " . $perl );
$Data::Dumper::Indent = 1;
ok(($perl->{body} and $perl->{body}->[0]), "EDI interchange body is a populated arrayref!");
is(scalar(@{$perl->{body}}), 3, "EDI interchange body has 3 messages");
my $i = 0;
foreach my $part (@{$perl->{body}}) {
( run in 1.135 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )