bug_7613: OCLC Connexion gateway
[koha_gimpoz] / t / db_dependent / lib / KohaTest / ImportBatch / GetImportBatch.pm
1 package KohaTest::ImportBatch::getImportBatch;
2 use base qw( KohaTest::ImportBatch );
3
4 use strict;
5 use warnings;
6
7 use Test::More;
8
9 use C4::ImportBatch;
10 use C4::Matcher;
11 use C4::Biblio;
12
13
14 =head3 add_one_and_find_it
15
16 =cut
17
18 sub add_one_and_find_it : Test( 7 ) {
19     my $self = shift;
20
21     my $batch = {
22         overlay_action => 'create_new',
23         import_status  => 'staging',
24         batch_type     => 'batch',
25         file_name      => 'foo',
26         comments       => 'inserted during automated testing',
27     };
28     my $batch_id = AddImportBatch($batch);
29     ok( $batch_id, "successfully inserted batch: $batch_id" );
30
31     my $retrieved = GetImportBatch( $batch_id );
32
33     foreach my $key ( keys %$batch ) {
34         is( $retrieved->{$key}, $batch->{$key}, "both objects agree on $key" );
35     }
36     is( $retrieved->{'import_batch_id'}, $batch_id, 'batch_id' );
37 }
38
39 1;