|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 2; |
22 |
use Test::More tests => 3; |
| 23 |
|
23 |
|
| 24 |
use Koha::Edifact::Order; |
24 |
use Koha::Edifact::Order; |
| 25 |
|
25 |
|
|
Lines 29-34
my $schema = Koha::Database->new->schema;
Link Here
|
| 29 |
|
29 |
|
| 30 |
my $builder = t::lib::TestBuilder->new; |
30 |
my $builder = t::lib::TestBuilder->new; |
| 31 |
|
31 |
|
|
|
32 |
subtest 'beggining_of_message tests' => sub { |
| 33 |
plan tests => 2; |
| 34 |
|
| 35 |
$schema->storage->txn_begin; |
| 36 |
|
| 37 |
my $basketno = sprintf '%011d', '123456'; |
| 38 |
my $edi_vendor = $builder->build( |
| 39 |
{ |
| 40 |
source => 'VendorEdiAccount', |
| 41 |
value => { |
| 42 |
standard => 'EUR', |
| 43 |
} |
| 44 |
} |
| 45 |
); |
| 46 |
my $dbic_edi_vendor = $schema->resultset('VendorEdiAccount')->find($edi_vendor->{id}); |
| 47 |
|
| 48 |
my $bgm = Koha::Edifact::Order::beginning_of_message($basketno, $dbic_edi_vendor, 1); |
| 49 |
is( $bgm, qq{BGM+220+$basketno+9'}, "When vendor is set to EDItEUR standard we use 220 in BGM segment"); |
| 50 |
|
| 51 |
$dbic_edi_vendor->update({ standard => 'BIC'}); |
| 52 |
$bgm = Koha::Edifact::Order::beginning_of_message($basketno, $dbic_edi_vendor, 1); |
| 53 |
is( $bgm, qq{BGM+220+$basketno+9'}, "When vendor is set to BiC standard we use 22V in BGM segment"); |
| 54 |
|
| 55 |
$schema->storage->txn_rollback; |
| 56 |
}; |
| 57 |
|
| 32 |
subtest 'order_line() tests' => sub { |
58 |
subtest 'order_line() tests' => sub { |
| 33 |
# TODO: Split up order_line() to smaller methods in order |
59 |
# TODO: Split up order_line() to smaller methods in order |
| 34 |
# to allow better testing |
60 |
# to allow better testing |
| 35 |
- |
|
|