Bugzilla – Attachment 155174 Details for
Bug 34415
Remove Test::DBIx::Class from t/EdiTransport.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34415: Remove T::D::C from EdiTransport.t, move to t/db
Bug-34415-Remove-TDC-from-EdiTransportt-move-to-td.patch (text/plain), 4.05 KB, created by
Marcel de Rooy
on 2023-09-02 13:43:16 UTC
(
hide
)
Description:
Bug 34415: Remove T::D::C from EdiTransport.t, move to t/db
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-09-02 13:43:16 UTC
Size:
4.05 KB
patch
obsolete
>From d928b695ea1f9ca5528d51ec08b103e523dc6812 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 26 Jul 2023 07:29:06 +0000 >Subject: [PATCH] Bug 34415: Remove T::D::C from EdiTransport.t, move to t/db >Content-Type: text/plain; charset=utf-8 > >Moving file now here. > >Test plan: >Run t/db_dependent/Koha/Edifact/Transport.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/EdiTransport.t | 57 ----------------------- > t/db_dependent/Koha/Edifact/Transport.t | 61 +++++++++++++++++++++++++ > 2 files changed, 61 insertions(+), 57 deletions(-) > delete mode 100755 t/EdiTransport.t > create mode 100755 t/db_dependent/Koha/Edifact/Transport.t > >diff --git a/t/EdiTransport.t b/t/EdiTransport.t >deleted file mode 100755 >index fb2442ea7e..0000000000 >--- a/t/EdiTransport.t >+++ /dev/null >@@ -1,57 +0,0 @@ >-#!/usr/bin/perl >- >-use Modern::Perl; >-use FindBin qw( $Bin ); >-use Test::More; >-use Test::MockModule; >-use Module::Load::Conditional qw/check_install/; >- >-BEGIN { >- if ( check_install( module => 'Test::DBIx::Class' ) ) { >- plan tests => 5; >- } >- else { >- plan skip_all => 'Need Test::DBIx::Class'; >- } >- >-} >- >-use Test::DBIx::Class; >- >-fixtures_ok [ >- VendorEdiAccount => >- [ [ 'id', 'description', 'transport' ], [ 1, 'test vendor', 'FILE' ], ], >- EdifactMessage => [ >- [ 'message_type', 'filename', 'raw_msg' ], >- [ 'TEST', 'duplicate', 'message_contents' ], >- ], >- ], >- 'add_fixtures'; >- >-my $filename = 'QUOTES_413514.CEQ'; >- >-my $db = Test::MockModule->new('Koha::Database'); >-$db->mock( _new_schema => sub { return Schema(); } ); >- >-use_ok('Koha::Edifact::Transport'); >- >-my $trans = Koha::Edifact::Transport->new(1); >- >-isa_ok( $trans, 'Koha::Edifact::Transport' ); >- >-$trans->working_directory("$Bin/edi_testfiles"); >- >-my $mhash = $trans->message_hash(); >-$mhash->{message_type} = 'TEST'; # set a bogus message type >- >-$trans->ingest( $mhash, $filename ); >- >-my $cnt = ResultSet('EdifactMessage')->count(); >- >-is( $cnt, 2, 'unique message name ingested' ); >- >-$trans->ingest( $mhash, $filename ); # try a repeat ingest >- >-my $cnt2 = ResultSet('EdifactMessage')->count(); >- >-is( $cnt2, 2, 'duplicate message name not ingested' ); >diff --git a/t/db_dependent/Koha/Edifact/Transport.t b/t/db_dependent/Koha/Edifact/Transport.t >new file mode 100755 >index 0000000000..83f05afa68 >--- /dev/null >+++ b/t/db_dependent/Koha/Edifact/Transport.t >@@ -0,0 +1,61 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+use FindBin qw( $Bin ); >+use Test::More tests => 6; >+use Test::Warn; >+ >+use t::lib::TestBuilder; >+ >+use Koha::Database; >+ >+use_ok('Koha::Edifact::Transport'); >+ >+my $schema = Koha::Database->new->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+$schema->storage->txn_begin; >+ >+my $account = $builder->build( >+ { >+ source => 'VendorEdiAccount', >+ value => { >+ description => 'test vendor', transport => 'FILE', >+ } >+ } >+); >+$builder->build( >+ { >+ source => 'EdifactMessage', >+ value => { message_type => 'TEST', filename => 'duplicate', raw_msg => 'message_contents' } >+ } >+); >+ >+my $dirname = ( $Bin =~ /^(.*\/t\/)/ ? $1 . 'edi_testfiles/' : q{} ); >+my $filename = 'QUOTES_413514.CEQ'; >+ok( -e $dirname . $filename, 'File QUOTES_413514.CEQ found' ); >+ >+my $trans = Koha::Edifact::Transport->new( $account->{id} ); >+ >+isa_ok( $trans, 'Koha::Edifact::Transport' ); >+ >+$trans->working_directory($dirname); >+ >+my $mhash = $trans->message_hash(); >+$mhash->{message_type} = 'TEST'; # set a bogus message type >+ >+$trans->ingest( $mhash, $filename ); >+ >+my $cnt = $schema->resultset('EdifactMessage')->count(); >+ >+is( $cnt, 2, 'unique message name ingested' ); >+ >+# try a repeat ingest >+warning_like { $trans->ingest( $mhash, $filename ) } qr/skipping ingest of QUOTES_413514.CEQ/, >+ 'Warning on repeated ingest'; >+ >+my $cnt2 = $schema->resultset('EdifactMessage')->count(); >+ >+is( $cnt2, 2, 'duplicate message name not ingested' ); >+ >+$schema->storage->txn_rollback; >-- >2.30.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 34415
:
153906
|
153907
|
153908
|
153909
|
153943
|
153944
|
153945
|
153946
|
155174
|
155798